Switch and Iterative statements in Objective C

preview_player
Показать описание


Switch and Iteratioanal statements are a common feature used in all
the programming languages.
Switch is used to choose an option from a list based on a specific
criteria. The value inside the switch statement (between rounded
parantheses) should have int value. In other languages there may be
also string values, but in Objective-C that is not allowed.
The iterational statements in Objective-C are for, while, and do ... while.
"for" is used when we know how many steps that should be. "while" is
used when we want something to happen while a certain condition takes
place. "do ... while" is used to execute the same code until a condition
is true, and it always executes at least once.
There is also "fast-enumeration" statement, which allows to iterate
through a collection of objects in an elegant way.
Рекомендации по теме