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 in place : reverse « Array « Ruby
Ruby
Array
reverse
Reverse in place
a = [1,2,3] p a.reverse! p a # => [3, 2, 1]
Related examples in the same category
1.
Reverse the Order of the Array's Elements
2.
The reverse method reverses the order of the elements in an array, returning a new array of elements, reversed