#IF
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgPpif
- 最后更新: 2023-10-02
预处理器条件指令
语法
vb
#if (expression)
' Conditionally included statements
#endif说明
在编译时有条件地包含语句。
如果 expression 的值为真(非零),则包含 #if / #endif 块中的语句;如果 expression 的值为假(0),则排除(忽略)这些语句。
该条件指令与 If 条件语句的区别在于:#if 在编译时求值,而 If 在运行时求值。
示例
start GeSHi
vb
#define DEBUG_LEVEL 1
#IF (DEBUG_LEVEL >= 2)
' This line is not compiled since the expression is False
Print "Starting application"
#ENDIFend GeSHi
与 QB 的区别
- FreeBASIC 新增
另请参阅
#define#macro#else#elseif#elseifdef#elseifndef#endif#ifdef#ifndef#undefdefined#assert
返回 目录