11 Control Statements
11 Control Statements
Control Statements
Once upon a time . . .
Jerry Cain
CS 106AJ
October 5, 2018
slides courtesy of Eric Roberts
1
10/8/18
2
10/8/18
false, JavaScript exits from the loop and continues with the
statement following the end of the while body.
3. Execute the statements in the body of the loop. This statement counts backward from 99 to 1 by twos.
4. Evaluate step, which usually updates the control variable.
4. for (let x = 1; x <= 1024; x *= 2)
5. Return to step 2 to begin the next loop cycle.
This statement executes the loop body with the variable x taking on
successive powers of two from 1 up to 1024.
3
10/8/18
need to know to understand how many times the loop will run }
is explicitly included in the header line. }
The End