I don't get this - PLEASE HELP!


Please help me with topic 15 (Getting Technical)

I keep getting this error: Oops, try again. It looks like you didn't sort the books array in descending order. Did you remember to use .sort! instead of .sort ?

This is my code:

`books.sort! { |fifthbook, forthbook, thirdbook, secondbook, firstbook|  firstbook <=> 
secondbook }`

I just guessed this answer. Can someone please help me?

I'll keep trying.



Sorry, I forgot about the hint.


But can someone please make this code smaller?


Given an array of book titles, books, we only need to give two placeholder variables, in the order we wish to sort:

books.sort! { |firstbook, secondbook| firstbook <=> secondbook }

will sort in ascending order, a to z. Reverse the order of the comparison and it will sort in descending order, z to a.

The variables we use are arbitrary.

books.sort! { |a, z| z <=> a }


O.K. I'll try that.:heart: