rng.last â obj
rng.last(n) â an_array
rng.last(n) â an_array
Instance Public methods
Returns the last object in the range, or an array of the last
n
elements.
Note that with no arguments last
will return the object that
defines the end of the range even if exclude_end? is
true
.
1 2 3 4 | ( 10 .. 20 ).last #=> 20 ( 10 ... 20 ).last #=> 20 ( 10 .. 20 ).last( 3 ) #=> [18, 19, 20] ( 10 ... 20 ).last( 3 ) #=> [17, 18, 19] |
Please login to continue.