Answer Posted / Gaurav Khare
The break statement in Ruby is used to exit a loop (such as while, until, or for) immediately. When the break statement is encountered within a loop, the loop terminates and execution continues with the next statement outside of the loop.n```rubynfor i in 1..5n if i == 3n break # exits the loop heren endnnputs i # this line will not be executed for i=3 because we broke out of the loop
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers