Batch Mode Simulation : Structured SCL Statements : IF/THEN/ELSE Statement

IF/THEN/ELSE Statement

The IF/THEN/ELSE statement is used for conditional execution of SCL statements.

IF Boolean_expression
THEN statement [ ; statement . . . ]
ELSE statement [ ; statement . . . ]
END IF
 
 
Note: The ELSE statement is optional.

In this structured statement, the statements following the THEN and before ELSE are executed if the Boolean_expression is true. If false, the statements following the ELSE are executed. The Boolean_expression may include references to Rational Statemate elements as well as SCL variables and constants.

For example:
IF in(scanning) and level > 200 THEN
x := 5 ;
WRITE (’reset variable x \n’);
ELSE
IF level <= 20 THEN
WRITE (’no variable reset \n’);
END IF;
END IF;
 
 
Note: The ELSE statement is optional.