The following article will attempt to thoroughly and precisely explain how the following code snippets work: ["Aa", "AAA", "b", "aa", "Aaa"].sort [100, 77, 200, 7, 21].sort When sorting Strings, Array#sort uses the return value of the combined comparison operator (also known as the spaceship operator) String#<=> and the ASCII (hexadecimal)…