mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-06-29 17:17:05 +00:00
8 lines
358 B
Ruby
8 lines
358 B
Ruby
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 } |