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.



2182
2183
2184
2185
2186
2187
2188
2189
2190
# File 'vm_eval.c', line 2182

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);
}