Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more

In Files

  • proc.c
toggle debugging


Raised when Ruby can't yield as requested.

A typical scenario is attempting to yield when no block is given:

def call_block
  yield 42

raises the exception:

LocalJumpError: no block given (yield)

A more subtle example:

def get_me_a_return { return 42 }

raises the exception:

LocalJumpError: unexpected return

Public Instance Methods

exit_value() click to toggle source


local_jump_error.exit_value  -> obj

Returns the exit value associated with this LocalJumpError.

               static VALUE
localjump_xvalue(VALUE exc)
    return rb_iv_get(exc, "@exit_value");
reason → symbol click to toggle source

The reason this block was terminated: :break, :redo, :retry, :next, :return, or :noreason.

               static VALUE
localjump_reason(VALUE exc)
    return rb_iv_get(exc, "@reason");

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit