the exercise asks me to write a ruby program using the loop method to print the string "hi" 5 times which I tried
I can't seem to find the correct coding to solve the problem,i am clearly missing something!
def repeat(string, times) fail "times must be 5 or more" if times < 5 counter = 0 loop do print "hi" counter = counter + 1 if counter==5 break end end end
KRIS NIKOLAISENPro Student 47,481 Points
You aren't using the parameters in your code here:
replace the hard coded values with string and times and you should be good.