Ruby: Méthodes, blocs et tri


Hello could someone tell me what 's wrong with my code ? it should class those books in inversed alphabetical order

livres = ["Utopia", "Charlie et la chocolaterie","Une brève histoire du temps", "Guerre et Paix", "Un raccourci dans le temps"]

livres.sort! { |premierLivre, secondLivre| premierLivre <=> secondLivre }


What exercise are you on?


hello i'm on : Méthodes, blocs et tri (in french) should translate it by : methos, blocks and sort by


oups i forget : lesson 15


books = ["Charlie and the Chocolate Factory", "War and Peace", "Utopia", "A Brief History of Time", "A Wrinkle in Time"]

To sort our books in ascending order, in-place

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

Sort your books in descending order, in-place below

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


thanks a lot i must be too tired not to have think of it


If that was a solution, please click the check mark.