Project

General

Profile

Bug #12170 ยป catch.diff

skalee (Sebastian Skalacki), 03/11/2016 04:06 PM

View differences:

vm_eval.c
*
* catch(1) { 123 } # => 123
*
* If +throw(tag2, val)+ is called, Ruby searches up its stack for a +catch+
* block whose +tag+ has the same +object_id+ as _tag2_. When found, the block
* stops executing and returns _val_ (or +nil+ if no second argument was given
* to +throw+).
* If <code>throw(tag2, val)</code> is called, Ruby searches up its stack for
* a +catch+ block whose +tag+ has the same +object_id+ as _tag2_. When found,
* the block stops executing and returns _val_ (or +nil+ if no second argument
* was given to +throw+).
*
* catch(1) { throw(1, 456) } # => 456
* catch(1) { throw(1) } # => nil
    (1-1/1)