Skip to content

Option Dynamic

Paul Squires edited this page Sep 19, 2026 · 1 revision

Home › Array Functions › Option Dynamic

Option Dynamic

Specifies variable-length array declarations

Syntax

Option Dynamic

Description

Option Dynamic is a statement that specifies that any following array declarations are variable-length, whether they are declared with constant subscript ranges or not. This remains in effect for the rest of the module in which Option Dynamic is used, and can be overridden with Option Static. It is equivalent to the '$Dynamic metacommand.

Remarks

Dialect Differences

Differences from QB

  • New to FreeBASIC

See also

Examples

'' Compile with "-lang fblite" compiler switch

#lang "fblite"

Dim foo(99) As Integer      ' declares a fixed-length array

Option Dynamic

Dim bar(99) As Integer      ' declares a variable-length array

' ...

ReDim bar(199)              ' resize the array

Category: Array Functions
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally