Hi,
In message "[ruby-talk:6548] Small note on docs for Array#[]"
on 00/11/23, Robert Feldt <feldt / ce.chalmers.se> writes:
|
|IMHO the text
|
|"... Returns nil if any indices are out of range"
|
|from the docs for Array#[] does not fully specify the following behavior
|
|$ ruby -v -e 'puts [1,2,3][2,2].inspect'
|ruby 1.6.2 (2000-11-20) [i686-cygwin]
|[3]
|$ ruby -v -e 'puts [1,2,3][2..3].inspect'
|ruby 1.6.2 (2000-11-20) [i686-cygwin]
|[3]
For getting subarray, `index' means the start point of the subarray.
Is this make it clear?
matz.