Dim: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
Brendon (talk | contribs)
No edit summary
Line 25: Line 25:


[[Category:Language Reference]]
[[Category:Language Reference]]
[[Category:Variable]]

Revision as of 18:06, 24 August 2012

Dim nameA[([subscriptA [,subscriptB [,subscriptC...]]])]

[, nameB...[, nameC..., [...]]]

Description

Dim is used to declare variables and allocate storage space. The required component, nameA, is the name of the variable, it must follow standard variable naming conventions. The optional list of subscripts are the upper bounds of dimensions of an array variable. Up to 60 comma-separated dimensions may be declared. Script level variables are available to all procedures in the script; procedure level variables are available only in the procedure they are declared in. The lower bound of an array is always zero.

Example

Rem Dim Example
'Dim declares variables and allocatesstorage
'An empty variable named "Foo"
Dim Foo
'A one-dimensional array with 10 elements
Dim OneD(9)
'A two-dimensional array with 600 elements
'20 x 30
Dim TwoD(19, 29)

Related Items

Array, ReDim, Set