public Method

Array.reverse

array.reverse  an_array

Returns a new array containing self’s elements in reverse order.

[ "a", "b", "c" ].reverse   #=> ["c", "b", "a"]
[ 1 ].reverse               #=> [1]

Source Code

/*
*  call-seq:
*     array.reverse -> an_array
*  
*  Returns a new array containing <i>self</i>'s elements in reverse order.
*     
*     [ "a", "b", "c" ].reverse   #=> ["c", "b", "a"]
*     [ 1 ].reverse               #=> [1]
*/

static VALUE
rb_ary_reverse_m(ary)
   VALUE ary;
{
   return rb_ary_reverse(rb_ary_dup(ary));
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.