%If directive (LotusScript® Language)

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

A constant defined by a HCL software application, or one of the platform-identification constants described as follows. Refer to the product's documentation for a list of product-defined constants.

statements

Statements that are compiled if productConst evaluates to TRUE.

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 HCL 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.

Constant

Platform or functionality

WIN16

Windows with 16-bit API

WIN32

Windows with 32-bit API

WIN2K

Windows 2000

WINDOWS

Any Windows platform type (any of the preceding WINxx constants)

UNIX

Any UNIX type

LINUX

Linux

MAC

Macintosh System 7

OLE

OLE-2 is available

MAC68K

Macintosh Motorola 68000 version (running on either a 68xxx Macintosh or the PowerPC®)

MACPPC

Macintosh PowerPC® version

IBM i

IBM® AS400

OS390

IBM® S/390® User System Services

ZOS

IBM® z/OS® (OS390 is also TRUE)

For example, here are several platforms and the constants that identify them:

WIN16, WINDOWS

WIN32, WIN95, WIN40, WINDOWS

HP/UNIX 9.X

UNIX

Example