I'm going over the logic behind the combined comparison operator and it's ability to reverse the sort order of an array. For example, I could reverse the order of the following array:
books = ["Charlie and the Chocolate Factory", "War and Peace", "Utopia",
"A Brief History of Time", "A Wrinkle in Time"]
by adding this line of code:
books.sort! { |firstBook, secondBook| secondBook <=> firstBook }
My question is, why would I not be able to just call:
books.reverse!
on this array to get the reverse order?