User Guide : Scripting : Script Statements : Option Base Statement
 
Share this page             
Option Base Statement
The Option Base statement has no effect on an array declared with explicit bounds.
 
Description
Explicitly set the default lower bound for all array subscripts
Syntax
Option Base {0|1}
Remarks
The base of an array is the index value of its lower bound. The default base (lower bound) of an array is 0.
In a five-element, one-dimensional array, the lower bound is 0 and the upper bound is 4.
A five-element, one-dimensional array using Option Base 1 has a lower bound of 1 and an upper bound of 5.
See the table below for examples.
 
Statement
Dimensions
Lower Bound
Upper Bound
Elements
Option Base 0
1
0
4
5
Option Base 1
1
1
5
5
Option Base not used
1
0
4
5
Dim myarray (0 to 3)
1
0
3
4
The Option Base statement is not required. Use Option Base to explicitly set an array lower bound to 1.
If used, the Option Base statement must appear before any array declarations.
Use the To clause when you declare an array for more flexible control of the range of its subscripts.