What if we wanted to sort the books by title, but from Z – A, or descending order? It appears that Ruby’s sort method only works for A – Z, or ascending order.
sort method assumes by default that you want to sort in ascending order, but it accepts a block as an optional argument that allows you, the programmer, to specify how two items should be compared.
books in descending order on line 8. Use the example of sorting in ascending order on line 4 as a guide.
Display the result in the console.
Take this course for free