IF

From ASCEND

Jump to: navigation, search
This article is incomplete or needs expanding. Please help out by adding your comments.

The IF statement can be used in METHODs to define conditional model initialisation.

IF options.mixture_thermo_correlation = 'UNIFAC' THEN
    RUN UNIFAC_mixing_rule.clear;
END IF;

From the User's manual:

The IF statement can only appear in a method definition. Its syntax is

IF logical_expression THEN
    (* list of statements *)
ELSE
    (* list of statements *)
END IF;

or

IF logical_expression THEN
    (* list of statements *)
END IF;

If the logical expression has a value of TRUE, ASCEND will execute the state- ments in the THEN part. If the value is FALSE, ASCEND executes the state- ments in the optional ELSE part. Please use () to make the precedence of AND, OR, NOT, ==, and != clear to both the user and the system.

See also SWITCH, Conditional modelling.