ZBasic Language Reference
75
ZX Microcontroller Family
' prepare the external circuitry and activate it
Call TestSetup(i)
Call PutPin(12, j)
#endif
#endif
#if (Version >= 23) And (EXPERIMENTAL <> 0)
' prepare the external circuitry and activate it
Call TestSetup(i)
Call PutPin(12, j)
#endif
The two examples above have the same effect.
Conditional identifiers may be used in definitions, statements, and expressions as if they were constants
defined using the Const definition (but the converse is not true).
#define Version "V1.0"
#define arraySize 26
Dim myArray(1 To arraySize) as Byte
debug.print Version
One implication of this is that adding a definition of a conditional identifier may result in a compiler
message related to a Const definition warning about duplicate definitions. Conditional identifiers defined
using a compiler option are visible in all modules while those defined in a particular module are only
visible in that module. Also note that conditional identifiers are essentially module-level constants. This
is true even if they are defined in a procedure. A consequence of this is that in spite of whether a
conditional identifier is defined inside a procedure or not, its value is visible to all subsequent conditional
expressions in the module.
BasicX Compatibility Note
Conditional constructs are not supported in BasicX compatibility mode.
3.11 Error Directive
Sometimes it is useful to be able to purposely generate an error message in order to remind yourself of
some detail or condition that requires attention. Often, this is used in conjunction with conditional
directives to point out that an incompatible set of conditions exists.
The form of the error directive is shown below.
#error <message>
All of the characters beginning with the first non-white space character following #error up to the end-of-
line will appear as the error message. If the last character on the line is an underscore and is preceded
by a space or tab character, it is treated as a continued line and all of the characters on the next line up to
the end-of-line will also be part of the error message.
Example
#if PLATFORM = "alpha"
Const Frequency As Single = 42.347
#elseif PLATFORM = "beta"