Control Statements and Loops in Objective-C

In programming, as in life, you have to make decisions and act on them. Objective-C provides control statements and loops to help your program take action. You may want to repeat a set of instructions based on some condition or state, for example, or even change the program execution sequence. Here is the basic syntax for Objective-C control statements and loops.

if else

if (condition) {
statement(s) if the condition is true;
}
else {
statement(s) if the condition is not true;
}

for

for (counter; condition; update counter) {
statement(s) to execute while the condition is true;
}