Nesting If Statements in X Language Products

The Extended X Language products are unable to nest IF commands. For example, consider the following program.

XE1 
XD1 
O0000 
IF(INXXXX1) 
1"OUTER_IF 
IF(INXXXXX1) 
1"INNER_IF 
NIF 
O1111 
NIF 
XT 

The intention of this program is that if input 1 is active, the processor will execute the 1"1OUTER_IF command, then check to see if input 2 is on and, if so, print INNER IF. In the case that the first IF command is not true, the 4 outputs should stay off and the program should end. What will really happen is: if the first IF statement is not true, the program will skip to the command beyond the first NIF command, which is the 01111 command. The 4 outputs will turn on and the program will end. 

One technique that will allow you to perform the intended task is:

XE1

 

XD1

 

O0000

 

IF(INXXXX1)

 

1"OUTER_IF

;;;;;;;;;;;;;;;;;

VAR1=1

;Var1 causes the

WHILE(INXXXX1_AND_VAR1=1)

;while loop to be

1"INNER_IF

;A one time

VAR1=0

;comparison.

NWHILE

;;;;;;;;;;;;;;;;;;

O1111

 

NIF

 

XT