For Loop
Evaluation Procedure
<init>
is run once, only at the beginning<predicate>
is evaluated, iffalse
, the for loop execution stops<body>
is executed<update-expr>
is executed- Repeat from Step 2
Tip
When the break
keyword is evaluated, the loop exists immediately
Scope
A new frame is created during execution of the <body>
Tip
Uninitialized variables outside the scope of body can be initialized within the child frame (local scope), but do not effect the parent frame (global scope)
While Loops
Evaluation Procedure
<condition>
is evaluated, iftrue
,<body>
is executed- Repeat step 1
Do/While Loops
Evaluation Procedure
<body>
is executed, and<condition>
is checked- If
<condition>
istrue
, then repeat step 1