diff options
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r-- | ruby.html.markdown | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown index 7bd28d86..8f23b2e6 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -168,6 +168,10 @@ array[-1] #=> 5 # With a start index and length array[2, 3] #=> [3, 4, 5] +# Reverse an Array +a=[1,2,3] +a.reverse! #=> [3,2,1] + # Or with a range array[1..3] #=> [2, 3, 4] |