[AmigaOS 3.1 Command Reference\Else]
Purpose: To specify an alternative for an IF statement in a
ELSE is used in an IF block of a script to specify an alternative action in
case the IF condition is not true. If the IF condition is not true,
execution of the script will jump from the IF line to the line after ELSE;
all intervening commands will be skipped. If the IF condition is true, the
commands immediately following the IF statement are executed up to the ELSE.
Then, execution skips to the ENDIF statement that concludes the IF block.
Assume a script, called Display, contained the following block:
IF exists <name>
TYPE <name> NUMBER
ECHO "<name> is not in this directory"
To execute this script, you could enter:
1> EXECUTE Display work/prg2
If the work/prg2 file can be found in the current directory, the TYPE <name>
NUMBER command will be executed. The work/prg2 file will be displayed on the
screen with line numbers.
If the work/prg2 file cannot be found in the current directory, the script
will skip ahead to the ECHO "<name> is not in this directory" coommand. The
work/prg2 is not in this directory
Will be displayed in the Shell window.
Converted from AmigaGuide to HTML by Matt Owen