ID : 319
Dim
Function
To declare a local variable.
Syntax
Dim variable name As data type[ = initial value][, variable name As data type[ = initial value]]...
Guaranteed entry
- Variable name
- Designate a variable name. Each name must be specified in accordance with the Naming convention. Also an Array can be declared.
- Data type
- Designate a data type of each local variable to declare.
- Initial value
- Designate a value to be assigned when variable declaration. Designate constant.
Description
Declare a local variable.
More than one local variable can be declared.
Designate data type using the following identifiers.
Related Terms
Example
'!TITLE "Declaration of Variable"
' Declare variable in the designated type
Sub Sample_Dim
' Declare aaa as an integer type local variable
Dim aaa As Integer
aaa = 5 + 2
' Declare bbb as a position type local variable
Dim bbb As Position
bbb = CurPos
' Declare ccc as a single precision real number type local array variable of 5 elements
Dim ccc(4) As Single
For n = 0 To 4
ccc(n) = PosZ(CurPos)
Delay 1000
Next
End Sub
ID : 319