Dim: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
DIM ''nameA''[([''subscriptA'' [,''subscriptB'' [,''subscriptC''...]]])] <br />
Dim ''nameA''[([''subscriptA'' [,''subscriptB'' [,''subscriptC''...]]])] <br />
::[, ''nameB''...[, ''nameC''..., [...]]]
::[, ''nameB''...[, ''nameC''..., [...]]]


'''Description'''
== 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.
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'''
== Example ==


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


'''Related Items'''
== Related Items ==


[[array|ARRAY]], [[redim|REDIM]], [[set|SET]]
[[array|ARRAY]], [[redim|REDIM]], [[set|SET]]
[[Category:Language Reference]]

Revision as of 20:52, 8 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