+ 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.
2 Answers
+ 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
+ 4
yash You deserve a big thank you bro.