BLOCKS AND STATEMENTS
Iteration of
for
statement
14.12.2
14.12.1 Initialization of
for
statement
A
for
statement is executed by first executing the
ForInit
code:
If the
ForInit
code is a list of statement expressions ( 14.7), the expressions
are evaluated in sequence from left to right; their values, if any, are discarded.
If evaluation of any expression completes abruptly for some reason, the
for
statement completes abruptly for the same reason; any
ForInit
statement
expressions to the right of the one that completed abruptly are not evaluated.
If the
ForInit
code is a local variable declaration, it is executed as if it were a
local variable declaration statement ( 14.3) appearing in a block. In this case,
the scope of a declared local variable is its own initializer and any further
declarators in the
ForInit
part, plus the
Expression
,
ForUpdate
, and contained
Statement
of the
for
statement. If execution of the local variable declaration
completes abruptly for any reason, the
for
statement completes abruptly for
the same reason.
If the
ForInit
part is not present, no action is taken.
14.12.2 Iteration of
for
statement
Next, a
for
iteration step is performed, as follows:
If the
Expression
is present, it is evaluated, and if evaluation of the
Expression
completes abruptly, the
for
statement completes abruptly for the same rea
son. Otherwise, there is then a choice based on the presence or absence of the
Expression
and the resulting value if the
Expression
is present:
N
If the
Expression
is not present, or it is present and the value resulting from
its evaluation is
true
, then the contained
Statement
is executed. Then there
is a choice:
O
If execution of the
Statement
completes normally, then the following two
steps are performed in sequence:
First, if the
ForUpdate
part is present, the expressions are evaluated in
sequence from left to right; their values, if any, are discarded. If evalua
tion of any expression completes abruptly for some reason, the
for
statement completes abruptly for the same reason; any
ForUpdate
state
ment expressions to the right of the one that completed abruptly are not
evaluated. If the
ForUpdate
part is not present, no action is taken.
Second, another
for
iteration step is performed.
O
If execution of the
Statement
completes abruptly, see 14.12.3 below.
281
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved