⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Kernel
/
View File Name :
catch-i.ri
U:RDoc::AnyMethod[iI" catch:ETI"Kernel#catch;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"N+catch+ executes its block. If +throw+ is not called, the block executes ;TI"Nnormally, and +catch+ returns the value of the last expression evaluated.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"*catch(1) { 123 } # => 123 ;T:@format0o; ; [ I"PIf
throw(tag2, val)
is called, Ruby searches up its stack for ;TI"Qa +catch+ block whose +tag+ has the same +object_id+ as _tag2_. When found, ;TI"Qthe block stops executing and returns _val_ (or +nil+ if no second argument ;TI"was given to +throw+).;T@o;; [I"*catch(1) { throw(1, 456) } # => 456 ;TI"*catch(1) { throw(1) } # => nil ;T; 0o; ; [I"JWhen +tag+ is passed as the first argument, +catch+ yields it as the ;TI"parameter of the block.;T@o;; [I"(catch(1) {|x| x + 2 } # => 3 ;T; 0o; ; [I"IWhen no +tag+ is given, +catch+ yields a new unique object (as from ;TI"O+Object.new+) as the block parameter. This object can then be used as the ;TI"Cargument to +throw+, and will match the correct +catch+ block.;T@o;; [I"catch do |obj_A| ;TI" catch do |obj_B| ;TI" throw(obj_B, 123) ;TI") puts "This puts is not reached" ;TI" end ;TI" ;TI"% puts "This puts is displayed" ;TI" 456 ;TI" end ;TI" ;TI"# => 456 ;TI" ;TI"catch do |obj_A| ;TI" catch do |obj_B| ;TI" throw(obj_A, 123) ;TI"/ puts "This puts is still not reached" ;TI" end ;TI" ;TI"0 puts "Now this puts is also not reached" ;TI" 456 ;TI" end ;TI" ;TI" # => 123;T; 0: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I")catch([tag]) {|tag| block } -> obj ;T0[ I"(*args);T@BFI"Kernel;TcRDoc::NormalModule00