spec

Software for Diffraction

flow

flow control

DESCRIPTION

A statement_block is either a statement or

{ statementstatement; ... }

Conditionals

if (condition) statement_block

if (condition) statement_block else statement_block

Loops

while (condition) statement_block

for (start; condition; increment) statement_block

for (identifier in associative_array) statement_block

Branching within loop statement_blocks:

continue

break

To jump back to the command level (usually on errors):

exit

When the if command is entered from the keyboard, the main prompt will change to more>, prompting for the associated statement block. If a newline is entered with no statement or opening curly bracket {, one additional more> prompt will be displayed since spec doesn't not know if an else will be entered. If nothing is entered, spec will be finished parsing that if command instance.

When the while or for commands are entered from the keyboard, the main prompt will also change to more>. However, if nothing is entered after the first line and there is no open curly bracket, spec will be finished parsing the command.

SEE ALSO

syntax

Kernighan and Ritchie, The C Programming Language.