Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

ELSE Internal
Purpose: To specify an alternative action for an IF statement in a script file.
Format: ELSE
Template: (none)
Path: Internal
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.

Example

Assume a script, called 'Display', contained the following block:

IF exists <name>
    TYPE <name> NUMBER
ELSE
    ECHO "<name> is not in this directory"
ENDIF
To execute this script, you could enter: 3.OS4:> 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 would 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 diectory' command. The message:

work/prg2 is not in this directory would be displayed in the Shell window.

See also: IF, ENDIF, EXECUTE


Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it.


Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: February 9, 2006.