BARfly Help - BAR Implementation File Reference - Function Statements

  The "for" statement

ForStatement ::= ‘for’ S? ‘(‘ S? Expression? S? ‘;’ S? Expression? S? ‘;’ S? Expression? S? ‘)’ S? (ExecutableStatement | BracedStatements)

The “for” statement is an ordered loop.  All three expressions are optional.

The first expression, the initialization expression (if present), is evaluated before entering the loop.

The second expression, the evaluation expression (if present), is evaluated at the start of each loop iteration.  A false value for this expression signals an exit condition for the loop.

The third expression, the increment expression (if present), is evaluated at the end of each loop iteration.

If the evaluation expression is absent, a true condition is assumed for all iterations.

The statement or statement blocks can be executed any number of times (including zero times if the evaluation expression is initially false).


  See also:  [Evaluation and null statements] [The "goto" statement and text labels] [The "return" statement] [The "if" and "else" statements]
[The "for" statement] [The "while" statement] [The "do" statement] [The "switch," "case," and "default" statements]
[The "break" statement] [The "continue" statement] [Opcode and mod byte escape sequences]


BARfly Help Copyright © 2009 Christopher Allen