Next: , Previous: , Up: Conditionals   [Index]


6.4.1 Formulating Conditional Statements

The easiest form of a Conditional is as follows:

IF condition
  configuration statements …
ENDIF

The condition parameter can simply be an operating system name like ‘OS/2’ or ‘Linux’. You will soon see other conditions that can be formulated (see Conditions that can be tested). For the moment, we will always use operating system names as conditions.

For example, the following statement will only be evaluated on OS/2:

IF OS2
   Editor c:\boxer\b2.exe
ENDIF

In addition, you can specify that an alternate block of statements should be evaluated if the condition was not true:

IF OS2
   ;OS/2 version of the Boxer Editor
   Editor c:\boxer\b2.exe
ELSE
   ;DOS version of the Boxer Editor
   Editor c:\boxer\b.exe
ENDIF

If you want to test for multiple configurations, the ELSEIF statement is handy. Instead of writing a complicated statement like

IF OS2
  Editor c:\boxer\b2.exe
ELSE
  IF UNIX
    Editor /usr/bin/vi
  ELSE
    ;Must be DOS
    EDITOR c:\boxer\b.exe
  ENDIF
ENDIF

you can simply write:

IF OS2
  Editor c:\boxer\b2.exe
ELSEIF UNIX
  Editor /usr/bin/vi
ELSE
  Editor c:\boxer\b.exe
ENDIF

For compatibility with other Fidonet editors, the ELIF command can be used instead of the ELSEIF command.

As you might already have guessed from the examples, conditionals can be nested down to any depth, that is, inside an IF - ENDIF - block, you can start another IF block, and so on.