What we have seen so far enables us to interact with the user, process the input, and provide some output based on conditions we imposed. All of this is fine; and if the user calls our scripts with some arguments, we can store them in an array and process given that we know how many options they are passing to the command line. We must know in advance how many items the user will provide us with, otherwise we will lose those in excess. This is where an iterative construct comes in play. Since we already saw some examples, it can enumerate the content of an array and let us process its content without knowing in advance the number of items stored. In this chapter, we will have a look at how to use the for loop and while/until loop to get a strong grip on the data the user provides us with.
Germany
Slovakia
Canada
Brazil
Singapore
Hungary
Philippines
Mexico
Thailand
Ukraine
Luxembourg
Estonia
Lithuania
Norway
Chile
United States
Great Britain
India
Spain
South Korea
Ecuador
Colombia
Taiwan
Switzerland
Indonesia
Cyprus
Denmark
Finland
Poland
Malta
Czechia
New Zealand
Austria
Turkey
France
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Malaysia
South Africa
Netherlands
Bulgaria
Latvia
Australia
Japan
Russia