Code Editor
Learn
Methods, Blocks, & Sorting

Sorting

Finally, let's review what we learned about sorting.

books.sort! do |firstBook, secondBook| firstBook <=> secondBook end

Remember that the above example was how we sorted in alphabetical order.

Report a Bug
If you see a bug or any other issue with this page, please report it here.