π File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-22 05:09:31
π
/ (Root)
/
opt
/
alt
/
ruby27
/
share
/
ri
/
system
/
Array
π /opt/alt/ruby27/share/ri/system/Array
π Refresh
βοΈ
Editing: fetch-i.ri
Read Only
U:RDoc::AnyMethod[iI" fetch:ETI"Array#fetch;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"OTries to return the element at position +index+, but throws an IndexError ;TI"Qexception if the referenced +index+ lies outside of the array bounds. This ;TI"Perror can be prevented by supplying a second argument, which will act as a ;TI"+default+ value.;To:RDoc::Markup::BlankLine o; ; [I"IAlternatively, if a block is given it will only be executed when an ;TI"#invalid +index+ is referenced.;T@o; ; [I"@Negative values of +index+ count from the end of the array.;T@o:RDoc::Markup::Verbatim; [I"a = [ 11, 22, 33, 44 ] ;TI"%a.fetch(1) #=> 22 ;TI"%a.fetch(-1) #=> 44 ;TI"(a.fetch(4, 'cat') #=> "cat" ;TI"5a.fetch(100) {|i| puts "#{i} is out of bounds"} ;TI"8 #=> "100 is out of bounds";T:@format0: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"οΏ½ary.fetch(index) -> obj ary.fetch(index, default) -> obj ary.fetch(index) {|index| block} -> obj ;T0[ I"(p1, p2 = v2);T@!FI" Array;TcRDoc::NormalClass00
πΎ Save Changes
β Cancel