Method: Kernel#throw

Defined in:
vm_eval.c

#throw(tag[, obj]) ⇒ Object

Transfers control to the end of the active catch block waiting for tag. Raises UncaughtThrowError if there is no catch block for the tag. The optional second parameter supplies a return value for the catch block, which otherwise defaults to nil. For examples, see Kernel::catch.

[View source]

2482
2483
2484
2485
2486
2487
2488
2489
2490
# File 'vm_eval.c', line 2482

static VALUE
rb_f_throw(int argc, VALUE *argv, VALUE _)
{
    VALUE tag, value;

    rb_scan_args(argc, argv, "11", &tag, &value);
    rb_throw_obj(tag, value);
    UNREACHABLE_RETURN(Qnil);
}