public Method

Array.<<(p1)

array << obj             array

Append—Pushes the given object on to the end of this array. This

expression returns the array itself, so several appends
may be chained together.

   [ 1, 2 ] << "c" << "d" << [ 3, 4 ]

> [ 1, 2, "c", "d", [ 3, 4 ] ]

Source Code

/*
*  call-seq:
*     array << obj            -> array
*  
*  Append---Pushes the given object on to the end of this array. This
*  expression returns the array itself, so several appends
*  may be chained together.
*
*     [ 1, 2 ] << "c" << "d" << [ 3, 4 ]
*             #=>  [ 1, 2, "c", "d", [ 3, 4 ] ]
*
*/

VALUE
rb_ary_push(ary, item)
   VALUE ary;
   VALUE item;
{
   rb_ary_store(ary, RARRAY(ary)->len, item);
   return 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.