15. Getting Technicall


15. Getting Technical

I am passing this exercise , just use to revert the the given example .
seems like it is working and accepts it .
I am just trying yo understand why is doing that !!!!
the books a re indeed sorted backwards.
thank you!

Replace this line with your code. 
books.sort! { |secondBook , firstBook |firstBook <=> secondBook }


Also, on the 19th Exercise I had the same issue :

fruits = ["orange", "apple", "banana", "pear", "grapes"] fruits.sort! do | secondFruit, firstFruit| firstFruit <=> secondFruit end

It all worked out fine , but i don't understand the logic behind it !!!


You've named the first book secondBook and the second book firstBook. If you reverse the pairs, then you'll have a reversed result as well


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.