+ 4

How to remove printing range in for loop in ruby?

So, I made a linearSearch program in Ruby, but it does not only print index numbers but also prints range used for for loops, which I want to remove. https://code.sololearn.com/cS50mIajyZ5S/?ref=app I don't want to print 0..4 in my code. Help pls.

16th Aug 2018, 2:15 AM
Uttam
Uttam - avatar
2 Antworten
+ 7
You're using puts in linearSearch function so you don't need to print something from the called function.. Just doing "linearSearch(59, nums)" (rather than "puts linearSearch(59, nums)") solves your problem
16th Aug 2018, 2:54 AM
Yash✳️
Yash✳️ - avatar
+ 4
yash You deserve a big thank you bro.
16th Aug 2018, 2:55 AM
Uttam
Uttam - avatar