Method: Array#length

Defined in:
array.c

#lengthInteger #sizeInteger

Returns the count of elements in self:

[0, 1, 2].length # => 3
[].length        # => 0

Related: see Methods for Querying.

Overloads:



2747
2748
2749
2750
2751
2752
# File 'array.c', line 2747

static VALUE
rb_ary_length(VALUE ary)
{
    long len = RARRAY_LEN(ary);
    return LONG2NUM(len);
}