ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ???????????????????????????????????? ???????????????????????????????????? ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. ???????????????????????????????????? ???????????????????????????????????? U:RDoc::AnyMethod[iI"[]:ETI" Array#[];TF: publico:RDoc::Markup::Document: @parts[4o:RDoc::Markup::Paragraph; [I":Returns elements from +self+; does not modify +self+.;To:RDoc::Markup::BlankLineo; ; [I"In brief:;T@o:RDoc::Markup::Verbatim; [I"a = [:foo, 'bar', 2] ;TI" ;TI"3# Single argument index: returns one element. ;TI"5a[0] # => :foo # Zero-based index. ;TI"Ma[-1] # => 2 # Negative index counts backwards from end. ;TI" ;TI"5# Arguments start and length: returns an array. ;TI"a[1, 2] # => ["bar", 2] ;TI"Ma[-2, 2] # => ["bar", 2] # Negative start counts backwards from end. ;TI" ;TI"0# Single argument range: returns an array. ;TI"!a[0..1] # => [:foo, "bar"] ;TI"Sa[0..-2] # => [:foo, "bar"] # Negative range-begin counts backwards from end. ;TI"Qa[-2..2] # => ["bar", 2] # Negative range-end counts backwards from end. ;T: @format0o; ; [I"\When a single integer argument +index+ is given, returns the element at offset +index+:;T@o; ; [ I"a = [:foo, 'bar', 2] ;TI"a[0] # => :foo ;TI"a[2] # => 2 ;TI"a # => [:foo, "bar", 2] ;T; 0o; ; [I"EIf +index+ is negative, counts backwards from the end of +self+:;T@o; ; [I"a = [:foo, 'bar', 2] ;TI"a[-1] # => 2 ;TI"a[-2] # => "bar" ;T; 0o; ; [I"/If +index+ is out of range, returns +nil+.;T@o; ; [I"@When two Integer arguments +start+ and +length+ are given, ;TI"greturns a new +Array+ of size +length+ containing successive elements beginning at offset +start+:;T@o; ; [I"a = [:foo, 'bar', 2] ;TI" a[0, 2] # => [:foo, "bar"] ;TI"a[1, 2] # => ["bar", 2] ;T; 0o; ; [I"FIf start + length is greater than self.length, ;TI"9returns all elements from offset +start+ to the end:;T@o; ; [ I"a = [:foo, 'bar', 2] ;TI"#a[0, 4] # => [:foo, "bar", 2] ;TI"a[1, 3] # => ["bar", 2] ;TI"a[2, 2] # => [2] ;T; 0o; ; [I">If start == self.size and length >= 0, ;TI"!returns a new empty +Array+.;T@o; ; [I",If +length+ is negative, returns +nil+.;T@o; ; [I"4When a single Range argument +range+ is given, ;TI"0treats range.min as +start+ above ;TI"/and range.size as +length+ above:;T@o; ; [I"a = [:foo, 'bar', 2] ;TI" a[0..1] # => [:foo, "bar"] ;TI"a[1..2] # => ["bar", 2] ;T; 0o; ; [I"RSpecial case: If range.start == a.size, returns a new empty +Array+.;T@o; ; [I"NIf range.end is negative, calculates the end index from the end:;T@o; ; [ I"a = [:foo, 'bar', 2] ;TI"$a[0..-1] # => [:foo, "bar", 2] ;TI"!a[0..-2] # => [:foo, "bar"] ;TI"a[0..-3] # => [:foo] ;T; 0o; ; [I"RIf range.start is negative, calculates the start index from the end:;T@o; ; [ I"a = [:foo, 'bar', 2] ;TI"a[-1..2] # => [2] ;TI"a[-2..2] # => ["bar", 2] ;TI"$a[-3..2] # => [:foo, "bar", 2] ;T; 0o; ; [I"JIf range.start is larger than the array size, returns +nil+.;T@o; ; [ I"a = [:foo, 'bar', 2] ;TI"a[4..1] # => nil ;TI"a[4..0] # => nil ;TI"a[4..-1] # => nil ;T; 0o; ; [I"LWhen a single Enumerator::ArithmeticSequence argument +aseq+ is given, ;TI"Mreturns an +Array+ of elements corresponding to the indexes produced by ;TI"the sequence.;T@o; ; [I"7a = ['--', 'data1', '--', 'data2', '--', 'data3'] ;TI"7a[(1..).step(2)] # => ["data1", "data2", "data3"] ;T; 0o; ; [I"SUnlike slicing with range, if the start or the end of the arithmetic sequence ;TI"2is larger than array size, throws RangeError.;T@o; ; [ I"7a = ['--', 'data1', '--', 'data2', '--', 'data3'] ;TI"a[(1..11).step(2)] ;TI"3# RangeError (((1..11).step(2)) out of range) ;TI"a[(7..).step(2)] ;TI"1# RangeError (((7..).step(2)) out of range) ;T; 0o; ; [I"QIf given a single argument, and its type is not one of the listed, tries to ;TI";convert it to Integer, and raises if it is impossible:;T@o; ; [I"a = [:foo, 'bar', 2] ;TI"I# Raises TypeError (no implicit conversion of Symbol into Integer): ;TI" a[:foo] ;T; 0o; ; [I"NRelated: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].;T: @fileI" array.c;T:0@omit_headings_from_table_of_contents_below0I"self[index] -> object or nil self[start, length] -> object or nil self[range] -> object or nil self[aseq] -> object or nil slice(index) -> object or nil slice(start, length) -> object or nil slice(range) -> object or nil slice(aseq) -> object or nil ;T0[[I" slice;T@ I" (*args);T@FI" Array;TcRDoc::NormalClass00