Available since firmware version 7.6
Conditional Compilation allows boolean constants to determine whether a section of code should be compiled. Conditional compilation values are defined by the
#const identifier and has the form:
#const <constant-name> = <expression>
This initial release only supports
Constant names must be composed of alphanumeric characters, and optionally, the underscore
_character. There is no limit to the length of a constant name.
Constant names are case-insensitive.
A constant name should not be redefined if it has already been defined prior.
Defining a Constant
A constant can be defined in 2 ways:
- A manifest attribute in the channel package
- A constant locally scoped to individual BrightScript files
Conditional compilation values can be specified in the manifest via the
More than one conditional compilation value can be specified via semi-colon separated key-value pairs:
There are a variety of ways Conditional Compilation can be used:
#error constant can also be used to force a compilation error with an error message:
Conditional Compilation can also be used to form block comments. Previously, each line of code needed to be commented out.
Calling this function would result in a compile time error. To re-enable this function, change
#if false to