4 Matching Annotations
- Jul 2021
-
stackoverflow.com stackoverflow.com
-
You can do this elegantly with throw/catch, like this:
-
In most languages, there is no clean equivalent for breaking out of a recursive algorithm that uses a recursive function. In Ruby, though, there is!
-
it's much faster—the stack frame does not have to be carried along the "thrown symbol", and no object is created. Lightweight nonlinear flow control.
-
Throw it's a more elegant way to use an exception-like system as a control flow.
-