Ruby: control flow with throw and catch
This article
Show archive.org snapshot
will show you how to use throw
and catch
. It's a nice tool to break out of multiple loops when a result is obtained.
Also see our card Ruby: A small summary of what return, break and next means for blocks.