mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 01:51:38 +00:00
Corrects Array#[,] entry
The #[i,l] method returns a subarray starting at index i and continuing for length l. [source](http://ruby-doc.org/core-1.9.3/Array.html#method-i-5B-5D)
This commit is contained in:
parent
0868977067
commit
9a60d0a6e4
@ -139,8 +139,8 @@ array.[] 12 #=> nil
|
|||||||
# From the end
|
# From the end
|
||||||
array[-1] #=> 5
|
array[-1] #=> 5
|
||||||
|
|
||||||
# With a start and end index
|
# With a start index and length
|
||||||
array[2, 4] #=> [3, 4, 5]
|
array[2, 3] #=> [3, 4, 5]
|
||||||
|
|
||||||
# Or with a range
|
# Or with a range
|
||||||
array[1..3] #=> [2, 3, 4]
|
array[1..3] #=> [2, 3, 4]
|
||||||
|
Loading…
Reference in New Issue
Block a user