Ruby Loop -
- What is "fail" method here? How can it be used?
- Why there are 3 ends in the codes?
- Why repeat method isn't used if we take time to define it?
I give up!
def repeat(string, times) fail "times must be 1 or more" if times < 1 counter = 0 loop do # YOUR CODE HERE end end