Return to Statement


Logical IF Example 1

This example demonstrates the use of the logical IF statement. Logical operations may be performed on numerical variables and/or constants.

$$
$$ Declarations
$$
ENTITY/LN(3)
$$
$$ Geometry Definition
$$
LN(1)=LINE/-1,0,1,0

LN(2)=LINE/PARLEL,LN1,YLARGE,.5

LN(3)=LINE/-1,-.5,1,.5
$$
$$ Do Statements
$$
DO/A1:,I,1,3
$$
$$ Get the end points of the line
$$
OBTAIN/LN(I),X1,Y1,,X2,Y2,
$$
$$ If the line is not horizontal, ignore it
$$
IF/Y1<>Y2,JUMP/A1:
$$
$$ If the Y value is greater than zero, delete it
$$
IF/X1>0,DELETE/LN(I)
A1:

In the example above only LN(2) would be deleted as LN(3) is not a horizontal line and LN(1) is coincident with the X axis.