Mega Code Archive

 
Categories / Ruby / Array
 

Get the first and last elements of an array is with the first and last methods

q1 = %w[ January February March ] q1.first # => January q1.last # => March