====== #if constant ... #endif ====== The preprocessor directive ''#if'' will compare a constant declared with ''CONST'' to another constant. If the ''#if'' statement is true, the statements inside the ''#if...#endif'' block will be compiled, otherwise the statements will be discarded. Const Device = CB280 Delay 500 ' Device only returns the decimal number #If Device = 220 Debug "CB220 module used!" #endif The above example illustrates how, depending on the type of Cubloc/Cutouch declared, you can decide to include a command in the final compilation of your program. Using conditional directives, you will be able to write applications for different Cubloc/Cutouch modules with just one source file. Using the preprocessor directive ''#elseif'' or ''#else'', you can create more complex ''#if...#endif'' expressions. Const Device = CB220 Delay 500 ' Device only returns the decimal number #If Device = 220 Debug "CB220 module used!" #elseif device = 280 Debug "CB280 module used!" #elseif device = 290 Debug "CB290 module used!" #elseif device = 1720 Debug "CT1720 module used!" #endif ''#else'' may only be used ONCE in an ''#if'' expression. Also, you can only compare constants declared with the ''CONST'' statement in an ''#if'' directive. Nested ''#if'' directives are not supported; ''#if'' may not be used inside another ''#if''. See also [[:cubloc::ifdef..endif:|#ifdef...#ifndef]]. [[cubloc:index#system_library:|Go CUBLOC home]]