I know how to put an array in order, but in this case I just want to see if it is in order. An array of strings would be the easiest, I imagine, and answer
def ascending? (array) yes = true array.reduce { |l, r| break unless yes &= (l[0] <= r[0]); l } yes end def descending? (array) yes = true array.reduce { |l, r| break unless yes &= (l[0] >= r[0]); l } yes end