sort method. The simplest sort is
sorting an array of strings.
myArray = .array~of("Zoe", "Fred", "Xavier", "Andy")
myArray~sort
do name over myArray
say name
end
sort method orders the strings by using the
compareTo method of the String class. The
compareTo method knows how to compare one string to another, and
returns the values -1 (less than), 0 (equal), or 1 (greater than) to indicate the relative ordering
of the two strings.