Training
Module
Test conditions with if/else expressions in Rust - Training
Explore Rust compound data types like arrays, vectors, and hash maps. Discover how to use if/else statements to test conditions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The #if directive controls conditional compilation of the resource file by checking the specified constant expression. If the constant expression is nonzero, #if directs the compiler to continue processing statements up to the next #endif, #else, or #elif directive and then skip to the statement after the #endif directive. If the constant expression is zero, #if directs the compiler to skip to the next #endif, #else, or #elif directive.
#if constant-expression
constant-expression
Expression to be checked. This value is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.
This example compiles the BITMAP statement only if the value assigned Version is less than 3:
#if Version < 3
BITMAP 1 errbox.bmp
#endif
Training
Module
Test conditions with if/else expressions in Rust - Training
Explore Rust compound data types like arrays, vectors, and hash maps. Discover how to use if/else statements to test conditions.