Preprocessor directives are evaluated in the OScript source code before being compiled. These directives commonly substitute text or perform a conditional compile. OScript supports the following preprocessor directives:
The #define directive substitutes values for names during compilation. They are defined using the syntax:
#define Name Value
The Value substitute may be of any data type or function. For example:
#define ERROR_VALUE5
#define ERROR_MSG"File Not Found"
or
#define CONTENTSFile.Read( myFile )
The #undef directive undefines a #define token. A token is undefined using the syntax:
#undef identifier
For example:
#undef ERROR_MSG
The #ifdef, #ifndef, #else, and #endif directives are used together to determine which parts of a script are compiled. These conditional compilation directives allow for code portions to be either compiled or omitted, depending on the stated conditions. These directives use the syntax:
#ifdef identifier
...block of code...
#else
...block of code
#endif