UlyssesZh / UlyssesZh.github.io

Ulysses Zhan's blog!
https://UlyssesZh.github.io
MIT License
3 stars 3 forks source link

Labeled break, next, and redo in Ruby | Ulysses’ trip #84

Open UlyssesZh opened 1 year ago

UlyssesZh commented 1 year ago

https://ulysseszh.github.io/programming/2023/05/07/ruby-jump-label.html

Many languages support breaking out of nested loops, such as Perl, Java, JavaScript, C#, etc. Languages that have goto can also do this easily. However, in most other languages, it is not easy to break out of nested loops. I want to introduce a way to do this in Ruby.