+ 7
How to end a loop for in Ruby without break nor exit, (it doesn't exist in Ruby)
The answer is simple: You must define a variable type boolean, with value false, determine which is your condition to exit of the loop, when it happens changing the value of false by true, and then put the value of loop to maxim, making finishing the loop. As example For i in 1..10 If variable == false Some code If condition== true Variable ==true i==10 End End
1 Réponse
+ 2
Imagine that break doesn't exist. The way I put up, I it's a good way to solve the problem, but I in the meaning of I take the control of the flow