Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
Kernel
/
//opt/alt/ruby21/share/ri/2.1.0/system/Kernel/catch-i.ri
U:RDoc::AnyMethod[iI" catch:ETI"Kernel#catch;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"1+catch+ executes its block. If a +throw+ is ;TI">executed, Ruby searches up its stack for a +catch+ block ;TI"/with a tag corresponding to the +throw+'s ;TI"4_tag_. If found, that block is terminated, and ;TI"4+catch+ returns the value given to +throw+. If ;TI"?+throw+ is not called, the block terminates normally, and ;TI">the value of +catch+ is the value of the last expression ;TI";evaluated. +catch+ expressions may be nested, and the ;TI"/+throw+ call need not be in lexical scope.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"def routine(n) ;TI" puts n ;TI" throw :done if n <= 0 ;TI" routine(n-1) ;TI" end ;TI" ;TI"!catch(:done) { routine(3) } ;T:@format0o; ; [I"<em>produces:</em>;T@o;; [ I"3 ;TI"2 ;TI"1 ;TI"0 ;T; 0o; ; [ I">when _arg_ is given, +catch+ yields it as is, or when no ;TI"<_arg_ is given, +catch+ assigns a new unique object to ;TI"=+throw+. this is useful for nested +catch+. _arg_ can ;TI"-be an arbitrary object, not only Symbol.;T: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I")catch([arg]) {|tag| block } -> obj ;T0[ I"(p1 = v1);T@/FI"Kernel;TcRDoc::NormalModule00