Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Array#reverse

() -> ::Array[Elem]
reverse → new_array

Returns a new array containing the elements of self in reverse order:

Example
[0, 1, 2].reverse # => [2, 1, 0]

Related: see Methods for Combining.