| lang | ID |
|---|---|
| title | Saved, Tucked Away |
| answer | \[12, 35, 47\] |
| load | ticket = [12, 47, 35] |
| ok | You've sorted the list |
| error |
You've hung on to your lotto numbers, tucking them away inside a variable called ticket. But any other name, like jimmyslist, would have been fine too.
Programming, you will discover, is mostly about working with variables.
Let's put your lotto numbers in order, how about?
Use:
ticket.sort!
You had a list. You sorted the list. The ticket variable is now changed.
Did you notice that the sort! method has a big, bright exclamation at the end?
A lot of times Ruby methods shout like that if they alter the variable for good.
It's nothin special, just a mark.