Revised March 2024
IF <expr>
<statement(s) to execute if true>
ELSE
<statement(s) to execute if false>
ENDIF
(Used only from within CMD/DO files) IF, ELSE and ENDIF allow for the flow of control within a CMD or DO file based on various conditions that can be tested. They take no argument, and their usage should be clear from the following example. See Command Files for more information.
Example
Here is a simple example of a DO file that takes a filename argument. If the file (with a BAS extension) does not exist, it is created by making a copy of a file called applib:stdhdr.txt. Then, in either case, the file is opened with VUE.
IF LOOKUP("$0.BAS") = 0
COPY $0.BAS=APPLIB:STDHDR.TXT
ENDIF
VUE $0.BAS