Wiki source for KeyPgPpif


Show raw source

{{fbdoc item="title" value="#IF"}}----
Preprocessor conditional directive

{{fbdoc item="syntax"}}##
**#if** (expression)
' Conditionally included statements
[[KeyPgPpendif|#endif]]
##
{{fbdoc item="desc"}}
Conditionally includes statements at compile time.

Statements contained within the ##**#if**## / ##[[KeyPgPpendif|#endif]]## block are included if ##//expression//## evaluates to True (non-zero) and excluded (ignored) if ##//expression//## evaluates to False (##0##).

This conditional directive differs from the ##[[KeyPgIfthen|If]]## conditional statement in that ##**#if**## is evaluated at compile-time and ##[[KeyPgIfthen|If]]## is evaluated at run-time.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/prepro/if.bas"}}%%(freebasic)
#define DEBUG_LEVEL 1
#IF (DEBUG_LEVEL >= 2)
' This line is not compiled since the expression is False
Print "Starting application"
#ENDIF
%%

{{fbdoc item="diff"}}
- New to ""FreeBASIC""

{{fbdoc item="see"}}
- ##[[KeyPgPpdefine|#define]]##
- ##[[KeyPgPpmacro|#macro]]##
- ##[[KeyPgPpelse|#else]]##
- ##[[KeyPgPpelseif|#elseif]]##
- ##[[KeyPgPpendif|#endif]]##
- ##[[KeyPgPpifdef|#ifdef]]##
- ##[[KeyPgPpifndef|#ifndef]]##
- ##[[KeyPgPpundef|#undef]]##
- ##[[KeyPgDefined|defined]]##
- ##[[KeyPgPpassert|#assert]]##

{{fbdoc item="back" value="CatPgPreProcess|Preprocessor"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode