Syntax
define-directive: |
<variable-definition> |
|
<macro-definition> |
|
<default-visibility-set> |
variable-definition:
| (define | :) [private | protected | public] <ident> [[ <expr> ]] [[=] <expr>] |
macro-definition:
| (define | :) [private | protected | public] <ident> ( [<formal-macro-args>] ) <expr> |
default-visibility-set:
| (define | :) private | protected | public |
formal-macro-args:
| <formal-macro-arg> [, <formal-macro-arg>]... |
formal-macro-arg:
| <by-val-arg> | <by-ref-arg> |
by-val-arg:
| [<type-id>] <ident> [= <expr>] |
by-ref-arg:
| [<type-id>] * <ident> |
type-id:
| any | int | str | func |
Description
The first syntax ("variable-definition") defines a variable named ident, or assigns a value to an element of an array named ident (use dim instead of define to define the array variable itself). If none of the public, protected, or private keywords are specified, default visibility is assumed.
The second syntax ("macro-definition") defines a user defined function named ident. When defining a user defined function there must be no whitespace between the name and opening parenthesis, otherwise it will be treated as variable declaration.
The third syntax ("default-visibility-set") sets the default visibility of further variable and user defined function definitions in this file. If no visibility declaration occurs in a file, public visibility is assumed by default.
Examples
#define MyAppName "My Program"
#define MyAppExe MyAppName + ".exe"
#define MyAppVer GetVersionNumbersString(MyAppExe)
#define MyArray[0] 15
#define Multiply(int A, int B = 10) A * B
See also
dim, undef, Visibility of Identifiers.
User Defined Functions.