LOTUSSCRIPT LANGUAGE


%If directive
Example

Conditionally compiles a block of statements, depending on the value of one or more product constants.

Syntax

%If productConst

statements

[ %ElseIf productConst

statements ]

...

[ %Else

statements ]

%End If

Elements

productConst


statements
Usage

You cannot enter %If, %ElseIf, %Else, and %End If directly in the IDE. You must enter these directives in a file and insert the file in the IDE with the %Include directive.

productConst must appear on the same line as %If or %ElseIf. Nothing except a comment can appear on the same line following %If productConst or %ElseIf productConst, or on the same line with %Else or %End If. None of these lines can be continued with the underscore character (_).

To test each %If condition or %ElseIf condition in this statement, the LotusScript compiler calls the Lotus software application to evaluate the constant productConst. The product returns either TRUE (-1) or FALSE (0).

A condition is evaluated only if the product returns FALSE for the preceding condition. LotusScript compiles the statements for the first %If condition or %ElseIf condition that the product evaluates as TRUE. Once this happens, no further conditions are evaluated, and no further statements are compiled.

If neither the %If condition nor any %ElseIf condition evaluates to TRUE, the %Else statements (if any) are compiled.

You can include any number of %ElseIf directives in the block.

You can't include an %If block within an %If block.

LotusScript implements the constants in the following table as product #defines. When one of these is used as productConst, the LotusScript compiler does not call the product to evaluate productConst. LotusScript itself evaluates the constant as TRUE or FALSE. The value of each constant depends on the platform LotusScript is running on.
ConstantPlatform or functionality
WIN16Windows with 16-bit API (Windows 3.1)
WIN32Windows with 32-bit API (Windows NT or WindowsR 95)
WINNTWindows NT
WIN95Windows 95
WIN40Windows 95 or Windows NT 4.0
WIN98Windows 98
WIN2KWindows 2000
WINDOWSAny Windows platform type (any of the above WINxx constants)
HPUXHPR/UNIX 9.X or greater
SOLARISSun™/OS 5.0 or greater
UNIXAny UNIX type (HP_UXR or SolarisR)
OS2OS/2, version 2.0 or greater
LINUXLinux
MACMacintosh System 7
OLEOLE-2 is available
MAC68KMacintosh MotorolaR 68000 version (running on either a 68xxx Macintosh or the PowerPC™)
MACPPCMacintosh PowerPC version
OS400IBM AS400
OS390IBM S/390 User System Services
ZOSIBM z/OS (OS390 is also TRUE)
For example, here are several platforms and the constants that identify them:

Windows 3.1


Windows 95
HP/UNIX 9.X
OS/2 2.0 or greater
Example
See Also