ary.first â obj or nil
ary.first(n) â new_ary
ary.first(n) â new_ary
Instance Public methods
Returns the first element, or the first n
elements, of the
array. If the array is empty, the first form returns nil
, and
the second form returns an empty array. See also #last for the opposite effect.
a = [ "q", "r", "s", "t" ] a.first #=> "q" a.first(2) #=> ["q", "r"]
Please login to continue.