Books.sort.reverse!


#1

On "Getting Technical", books.sort.reverse! is not correct, even though it does the correct thing, which is sort all the books in descending order. The error message should probably say something along the lines of "this is correct, but not the way we are teaching you to do it right now!"


#2

Using books.sort!.reverse will permanently change the original books variable.

Using books.sort.reverse! will keep the original books variable unchanged, but will permanently change the result of books.sort, which might not be relevant.


#3

but there is nothing about "no result change"!
UPD: And here goes dat HINT: "Note that you don't have to use the combined comparison operator." :\


#4

both the sort and the reverse need to be locked (!) in order to pass the challenge


#5

books.sort! { |firstBook, secondBook| -(firstBook <=> secondBook) }