
|
for(initialization;test-condition;increment/decrement) { //statements to be iterated; } |



|
while(condition) { //statements to be iterated; increment/decrement counter; } |



| Note : While loop is a entry controlled loop because it check for the condition before entering the block. If the condition is true loop executes else loop exits. |
|
do { //statements to be iterated; increment/decrement counter; }while(condition); |



| Note : You have to be careful in specifying condition for loops . If you specify wrong conditions the loop will run infinitely and the program will crash. For example : for(;;) , while(true){} ,do{}while(true); |
|
foreach (type variable : array) { //statements; } |

