Skip to content

procedures Elseif

Paul Squires edited this page Sep 19, 2026 · 1 revision

Home › Preprocessor › #elseif

#elseif

Preprocessor conditional directive

Syntax

#if (expression1)
' Conditionally included statements if expression1 is True
#elseif (expression2)
' Conditionally included statements if expression2 is True
#else
' Conditionally included statements if both
' expression1 and expression2 are False
#endif

Description

#elseif can be added to an #if block to provide an additional conditions.

Remarks

Differences from QB

  • New to Freebasic

See also

Examples

#define WORDSIZE 16

#if (WORDSIZE = 16)

  ' Do some some 16 bit stuff

#elseif (WORDSIZE = 32)

  ' Do some some 32 bit stuff

#else

  #error WORDSIZE must be set To 16 Or 32

#endif

Category: Preprocessor
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally