Mega Code Archive
Categories
/
Ruby
/
Array
Access the First and Last Elements of the Array
# Accessing the first and last elements of an array is easy with the first and last methods x = [1, 2, 3] puts x.first puts x.last