title: What is catch and throw used for in Ruby?
body: <p>In most other languages, the catch and throw statements do what the begin, rescue, and raise statements do in Ruby. I know the you can do this with these two statements:</p>
  
  <pre><code>catch :done do
    puts "I'm done."
  end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if some_condition
    throw :done
  end
  </code></pre>
  
  <p>But what is this useful for? Can somebody please give me an example of what catch and throw statements are used for in Ruby?</p>