June 2025
Intermediate to advanced
152 pages
3h 15m
English
| Practice 25 | Line ’em Up |
This Ruby program contains a list of countries in the European Union.
| | COUNTRIES = ["Austria", "Belgium", "Bulgaria", "Croatia", "Republic of Cyprus", |
| | "Czech Republic", "Denmark", "Estonia", "Finland", "France" "Germany", |
| | "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg", |
| | "Malta", "Netherlands", "Poland", "Portugal", "Romania", |
| | "Slovakia", "Slovenia", "Spain", "Sweden" ] |
| | |
| | puts COUNTRIES.length #=> 26 |
When we print the length of the list, we get 26, but there should be 27. How long does it take you to see the problem?
Here’s the same list, formatted a little differently.
| | COUNTRIES = [ |
| | "Austria", "Belgium", "Bulgaria", |
Read now
Unlock full access