how to get first elements in array ruby code example Example: ruby get the first element of an array array = [1, 2, 3] array.first => 1