Learn

Sorting arrays is a very common problem in computer science, and is well studied for that reason. There are many algorithms —well-defined sequences of steps—each with its own trade-offs and advantages.

Sorting algorithms can be a great introduction to computer science as a theoretical discipline, but for now we’ll focus on how to use Ruby’s built-in sorting library (which implements a few of these algorithms).

Instructions

1.

Use the .sort! method to sort the values in my_array. Magic, isn’t it?

Display my_array in the console.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?