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!”

1 Like

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.

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.” :\

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

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