if clause:
if(condition) { //do something if condition is true }
if else clause:
if(condition) { //do something } else { //do something else }
while clause:
while(condition) { //do something }
while is used to make loops. an example:
//sum of array float sum; sum = 0; int i; i = 0; while(i<10) { sum = sum + fArray[i]; i = i + 1; } @"Sum is : "@sum; @"\n";
Note that if the line
i = i + 1;
is removed, the loop would be stuck because i<10 would always result true,
thus resulting into an infinite loop.
There was an error while loading. Please reload this page.