Declares and allocates storage space for one or more variables.

Dim var1[(dim1)] [as Type1], var2[(dim2)] [as Type2], ..., varN[(dimN)] [as TypeN]


Dim a as String

a = "Hello World"

Print a

Using Dim you can also specify the maximum values for array variable and allocate storage accordingly.

An array must be declared in order to be used.

The Dim statement sets all the elements of the specified arrays to an initial value of zero or empty string.


Dim x(10)

For i%=0 To 9: x(i%) = i% : Next

See also Arrays