Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Ordering Your Library

Sorting With Control Flow

Great! Now we need to add the right logic to our method.

numbers = [1, 2, 3, 4, 5] numbers.reverse! puts numbers
  1. In the example above, we create an array called numbers.
  2. Then, we reverse the array. Like with .sort!, the exclamation mark means we modify the actual array.
  3. Finally, we print out 5, 4, 3, 2, and 1.
Report a Bug
If you see a bug or any other issue with this page, please report it here.