mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-27 04:44:08 +03:00
commit
d1a822f96c
@ -168,6 +168,10 @@ array[-1] #=> 5
|
|||||||
# With a start index and length
|
# With a start index and length
|
||||||
array[2, 3] #=> [3, 4, 5]
|
array[2, 3] #=> [3, 4, 5]
|
||||||
|
|
||||||
|
# Reverse an Array
|
||||||
|
a=[1,2,3]
|
||||||
|
a.reverse! #=> [3,2,1]
|
||||||
|
|
||||||
# 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