Creating an Array: Difference between revisions

→‎{{header|BASIC}}: Dimension given is the upper bound.
(Task description: initialize array with data.)
(→‎{{header|BASIC}}: Dimension given is the upper bound.)
Line 169:
{{works with|PB|7.1}}
 
The default array base (lower bound) can be set with OPTION BASE. If OPTION BASE is not set, the base may be either 0 or 1, depending on implementation. The value given in DIM statement is the implementationupper bound. If the base is 0, then DIM a(100) will create an array containing 101 elements.
<lang qbasic> OPTION BASE 1
DIM myArray(100) AS INTEGER </lang>
 
Alternatively, the lowlower and highupper bounds can be given while defining the array:
<lang qbasic> DIM myArray(-10 TO 10) AS INTEGER </lang>
 
Anonymous user