Contents
- Index
Declare (command)
Declare <Var=Varname> <Type=Date|Numeric|String|Boolean>
Explicitly declare variables.
Although not a prerequisite, this command is usually used in conjunction with "Option Explicit=Yes". It allows you to declare your variable names and type so as to avoid typing errors later in your macro. In addition, speed benefits become very apparent when you are using a large number of variables and/or there are many lines of code in your macro.
Form variables are automatically declared when you display a form (using the Form() function). However if you wish to change a form variable *before* it is first displayed then you must list these variables in a Declare statement.
You do not need to declare any persistent variables you may be using.
Note: All declare statements are actually handled by the macro preprocessor which is run before any lines of macro code are executed. The preprocessor scans every line of code and any Declare statements create variables in the Global stack. The main reason for handling Declare statements this way is speed. Variables that are explicitly created in the variable stack before the macro is run will run much quicker than when the variables are created implicitly by running expressions that create new variables. This speed difference is
VERY noticeable when you have a large number of variables.
Related: Option
Alpha List Category List