public Method

Array.length

array.length  int

Returns the number of elements in self. May be zero.

[ 1, 2, 3, 4, 5 ].length   #=> 5

Source Code

/*
*  call-seq:
*     array.length -> int
*  
*  Returns the number of elements in <i>self</i>. May be zero.
*     
*     [ 1, 2, 3, 4, 5 ].length   #=> 5
*/

static VALUE
rb_ary_length(ary)
   VALUE ary;
{
   return LONG2NUM(RARRAY(ary)->len);
}
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.