Data editing > Flow control > Statements of condition: else
 
Statements of condition: else
Quick reference
To define statements to be executed if a given condition does not exist, type:
if (logical_expr) statement(s); else; statement1[; statement2; ...]
More information
The keyword else means ‘otherwise’.
if (expression) statement(s); else; statement(s)
This says, if the expression is true, execute the statements immediately after the if, but if it is false, execute those following the else. For example:
if (c76'4') t3=1; delete c76'3'; else; t3=2; emit c77'2'
Here, if c76 contains a ‘4’, t3 is set to 1 and a ‘3’ is deleted from c76. However, if c76 does not contain a ‘4’, t3 is set to 2 and a ‘2’ is added into c77.
The else keyword can only be used as part of an if statement and must be separated from the if by at least a semicolon. Statements of the form:
if (c115'1'); else; emit c140'&'
are correct, but since action is only required if the expression is not true, it is more usual to write:
if (c115n'1') emit c140'&'
See also
Flow control