Loops let you repeat code multiple times
Lopps take 3 parameters
int i = 0
i<10
i++
Int i- Each lopp needs a counter variable. This integer is "I"
for uterator, and is set to be 0.
I<10- There needs to be a conditional statement. For example, I must be less than 10 for the look to run.
There must also be an increment statement. ++ is an operator that simply adds one to the variable that precedes it. Since i is initialized to 0 after the loop has run once, i will be changed to 1 (0+1=1). Each time the loop runs i increases by 1 until the 10th time. When i equals 0 the loop stops since i must be less than 10.No Semi Colon After Loops!
Click Me to go back to the main page!