Special label used to terminate an if construct

BREAKIF

Special label used to terminate an if construct


SYNTAX

trap = BREAKIF

This label is only used within the trap clause of a Sculptor command. It causes execution to jump out of a block of statements controlled by an ifthenelse condition. It may only be used within the braces of an if or else construct.

The trap may be any valid trap for the Sculptor command being used.

Control is passed to the statement following the terminating right brace of the if construct. If there is no else clause, this is the statement following the terminating right brace of the if clause. If there is an else clause, it is the statement following the terminating right brace of the else clause. If the else clause consists of a single statement without enclosing braces, then control passes to the statement following this single statement.

A single if or else statement is not a block. The breakif command has no effect on such a statement. However, if the single if or else falls within the braces of an outer if construct, breakif breaks the outer if. This is shown in the following example, where the breakif statement passes control to the statement following the closing brace:

if (condition) {
     statements
     if (condition) {
          read file2 nsr = BREAKIF
          statements
     }
}

NOTES

  • Functionally equivalent to the breakif command.

  • If the BREAKIF label is used outside the braces of an if construct, the compiler error “breakif must be inside an if statement” is generated.


RELATED TOPICS

breakif

BREAK

CONTINUE

Traps