( --> )
Example Specification (Simple Selection)
Syntax
-
if <ParenthesizedExpression>
<StatementBlock>
-
if <ParenthesizedExpression>
<StatementBlock>
else
<StatementBlock>
-
if <ParenthesizedExpression>
<StatementBlock>
{ else if <ParenthesizedExpression>
<StatementBlock> }
[ else <StatementBlock> ]
Semantics
-
Evaluate the <ParenthesizedExpression>.
If the
value is true, execute the statement block.
Otherwise,
don't.
-
Evaluate the <ParenthesizedExpression>.
If the
value is true, execute the first statement block.
Otherwise, execute the second statement block.
-
Evaluate the <ParenthesizedExpression>s, in turn.
Execute the <StatementBlock> corresponding to the first <ParenthesizedExpression> which evaluates to true.
If none do and the optional else clause is present,
execute the <StatementBlock> associated with the
else clause.