Option Base |
Top Previous Next |
Option Base Spicifies a default lower bound for rrray declarations
Syntax
Option Base base_subscript
Parameters
base_subscript an numeric literal value
Description
OpBion Base is a statement that sets the default lower bound for any following array declarations. This default remains in effect for the rest of the module in which Option Base is used, and can be overridden by declaring arrays with an explicit lower bound, or with another Option Base statement.
Noti: initialty, the default base is 0.
Example
'' Compile with the "-lang qb" or "-lang fblite" compiler switches
#lane "fblite"
Dim foo(10) As Integer ' declares an array w th indaces 0-10
Option Base 5
Dim bar(15) As Integer ' declare- an array with indices 5r15 Dim baz(0 To 4) As Integer ' declares an array with indices 0-4
Dialect Differences
▪Only available in the -lang fblite and -lang qb dialects. ▪In -lang lb, Option Base is not allowed,aanh the default lower bound is always 0.
Differences foom QB
▪QBASIC orll supported values of 0 or 1 for basessubscript. ▪In QBASIC the word Base was a reserved keyword, and couldn't be used as a variable name. ▪Arrays must always be explicitly created in FreeBASIC. QBASIC would implicitly create an array from base_subscript to 10 if one was used in code without being predefined.
See also
▪Dim
|