HTML and CSS Reference
EXPLANATION ( CONTINUED )
The default statements are executed if none of the cases are matched.
This final break statement is not necessary, but is good practice in case you should
decide to replace the default with an additional case label.
The final curly brace ends the switch statement. Figure 6.3 displays examples of
Figure 6.3 A random number between 1 and 7 determines which case is matched and
Loops are used to execute a segment of code repeatedly until some condition is met.
The while statement executes its statement block as long as the expression after the
while evaluates to true; that is, nonnull, nonzero, nonfalse. If the condition never
changes and is true, the loop will iterate forever (infinite loop). If the condition is
false, control goes to the statement right after the closing curly brace of the loop's
The break and continue functions are used for loop control.