Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Option Explicit StatementThis standard VB statement specifies that every variable in a module must be explicitly declared. SyntaxReturnsUsageBy default, Basic declares any variables that do not appear in a Dim, Global, ReDim, or Static statement. Option Explicit causes such variables to produce a "Variable Not Declared" error. Using the Option Explicit statement makes debugging code easier, because it forces you to declare variables before use. Good programming practice is to declare variables at the beginning of the unit within which they have scope (that is, at the beginning of the project, module, or procedure). Declaring variables in this manner simplifies finding their definitions when reading through code. The Option Explicit statement must be placed in the (general) (declarations) section in the Siebel VB Editor, as shown in Option Base Statement. ExampleThis example specifies that variables must be explicitly declared, thus preventing any mistyped variable names. Option Explicit See AlsoConst Statement |
Siebel VB Language Reference |