Return to Statement


Logical IF Example 2

The following example shows how logical operations may be performed on an object variable.

$$
$$ Declarations
$$
ENTITY/PT1,NT1,OBJ(25)
.
.
.
L10:IDENT/'DELETE OBJECTS',OBJ,RESP
JUMP/L10:,TERM:,,,,RESP
DELETE/OBJ
.
.
.
IF/PT1==&NULENT,JUMP/L30:
L20:NT1=NOTE/DELTA,PT1,.25,.25,'BILL OF MATERIALS'
JUMP/L40:
L30:PT1=POINT/2,2
JUMP/L20:
L40:

PT1 might get deleted by the class selection (IDENT). To avoid an error when the NOTE statement tries to use a deleted PT1, the IF statement uses the Null Object GPA &NULENT to see if PT1 exists. If it does not, execution jumps to label L30: where PT1 is recreated. If PT1 was not deleted, the IF statement lets execution go directly to the NOTE statement.