Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Reverse the Order of the Array's Elements : reverse « Array « Ruby
Ruby
Array
reverse
Reverse the Order of the Array's Elements
x = [1, 2, 3] puts x.reverse.inspect
Related examples in the same category
1.
The reverse method reverses the order of the elements in an array, returning a new array of elements, reversed
2.
Reverse in place