OPTION _EXPLICITARRAY - mkilgore/QB64pe GitHub Wiki



OPTION _EXPLICITARRAY instructs the compiler to require arrays be declared with DIM, REDIM or equivalent.

Syntax

OPTION _EXPLICITARRAY

Description

  • Normally statements like x(2) = 3 will implicitly create an array x(). OPTION _EXPLICITARRAY requires a preceding declaration for the array, helping to catch mistyped array and function names.
  • Unlike OPTION _EXPLICIT, simple variables can still be used without a declaration. Example: i = 1

Errors

Examples

Example: Avoiding simple typos with OPTION _EXPLICITARRAY results shown in the QB64 IDE Status area.

DIM z(5)
z(2) = 3 'All good here, we've explicitly DIMmed our array

y(2) = 3 'This now generates an error

QB64 IDE Status will show: Array 'y' (SINGLE) not defined on line 7

See also


Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
⚠️ **GitHub.com Fallback** ⚠️