How to end execution of a block in Ruby? How to end execution of a block in Ruby? ruby ruby

How to end execution of a block in Ruby?


The keyword is next, not break. Break seems to be specific for the each method.


To exit a block or loop use the break keyword.

return will exit a method.