( --> )

Example Specification (Simple Selection)

Syntax

  1. if <ParenthesizedExpression> <StatementBlock>

  2. if <ParenthesizedExpression> <StatementBlock>
    else <StatementBlock>

  3. if <ParenthesizedExpression> <StatementBlock>
    { else if <ParenthesizedExpression> <StatementBlock> }
    [ else <StatementBlock> ]

Semantics

  1. Evaluate the <ParenthesizedExpression>.
    If the value is true, execute the statement block.
    Otherwise, don't.

  2. Evaluate the <ParenthesizedExpression>.
    If the value is true, execute the first statement block.
    Otherwise, execute the second statement block.

  3. 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.