This format of the @IF statement makes it possible to check in EDT procedures whether EDT identified a hit the last time @ON was executed or whether the current work file is empty. Depending on the result, a specified string either is or is not processed as input.
Operation | Operands | L mode |
@IF | { .TRUE. [rel col] | .FALSE. | .EMPTY. }:[text] |
.TRUE. | Processing branches if a hit was identified in the current work file the last If | ||||||||||||||
rel | Defines the relational operator for the column numbers (see above):
| ||||||||||||||
col | Column number which is compared with the number of the column in which | ||||||||||||||
.FALSE. | Processing branches if no hit was identified in the current work file the last | ||||||||||||||
.EMPTY. | Processing branches if the current work file is empty. A work file is empty if | ||||||||||||||
text | EDT statement or data line. If the condition is fulfilled, the string is treated The If |
The previous specification of GOTO
or RETURN
without a colon continues to be supported for reasons of compatibility.
Note
Using @IF with @RETURN as a statement outside of procedures may cause EDT to terminate (see the @RETURN statement).
Example 1
5. @PRINT 1.0000 WHO 2.0000 WANTS 3.0000 TO TRY 4.0000 HIS LUCK 5. @PROC 8 1. @ @ON ! FIND 'I' 2. @ @IF .FALSE. : @GOTO 4 --------------------------------------- (1) 3. @ @CREATE !: '*' * 20 4. @ @CONTINUE 5. @END 5. @DO 8,!=%,$ --------------------------------------------------- (2) 5. @PRINT 1.0000 WHO 2.0000 WANTS 3.0000 TO TRY 4.0000 ******************** 5.
(1) | In work file 8, the line numbers are addressed via the loop counter |
(2) | Work file 8 is executed. During processing, all the lines in the main file are to be addressed in sequence by the loop counter |
Example 2
5. @PRINT 1.0000 WHO 2.0000 WANTS 3.0000 PLENTY OF 4.0000 LUCK? 5. @PROC 9 1. @ @ON ! FIND 'EN' 2. @ @IF .TRUE. = 3 : @GOTO 4 3. @ @GOTO 5 ----------------------------------------------------- (1) 4. @ @SUFFIX ! WITH ' GOOD' 5. @ @CONTINUE 6. @END 5. @DO 9,!=%,$ --------------------------------------------------- (2) 5. @PRINT 1.0000 WHO 2.0000 WANTS 3.0000 PLENTY OF GOOD 4.0000 LUCK? 5.
(1) | In the procedure in work file 9, the line numbers are addressed via the loop counter If the string |
(2) | The procedure in work file 9 is executed. During processing, all the lines in the main file are addressed in sequence by the loop counter |