|
||||||||
|
||||||||
|
For Loops
General Formulafor (starting
integer; Boolean test; moving to stopping condition)
} Examplesfor (int x = 0 ; x < 10 ; x++)
} Prints out: 0 1 2 3 4 5 6 7 8 9
for (int x = 0 ; x < 10 ; x+=2)
} Prints out: 0 2 4 6 8
} Prints out: 3 4 5 6 7 8 9 10
for (int x = 10; x > 0 ; x--)
} Prints out: 10 9 8 7 6 5 4 3 2 1
|
|||||||
|