Aspen SCM‎ > ‎Expert System‎ > ‎2. Flow of Control‎ > ‎

2.2 IF and THEN

Each rule begins with an IF in the Code and ends with a THEN in the Code.

IF and the Name of a Rule

The presence of an IF in the Code leads the interpreter to regard as the name of the rule whatever was the last non-blank entry in the Code preceding the IF (except for entries which begin with NOTE, which are disregarded). This name is deposited in the set $RULE and is the name by which the rule can be run, e.g. >MYRULE.

If there is no non-blank entry preceding the IF, the name of the rule set is deposited in $RULE as the name of the rule. A common practice is to use NOTE in the Code for a block of comments after the name of the rule and before the IF statement. Typing mistakes can lead to rules named NTOE; the line containing the rule name is then ignored.

THEN and Conclusions

The presence of a THEN in the Code indicates to the interpreter the start of the conclusion to the rule which started at the preceding IF. Most conclusions consist of a single predicate but they can contain other clauses connected by ANDs. Do not take advantage of this except to BREAK a loop when a predicate has been proved (see section 3.8).


Back                                Next
Comments