<< Prev        Next >>

ID : 3759

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.

Data type Identifier
Integer Type Integer
Single Precision Real Number Type Single
Double Precision Real Number Type Double
String Type String
Vector Type Vector
Position Type Position
Joint Type Joint
Homogeneous Translation Type Trans

Attention

I/O Type local variable cannot be declared with "Dim." Use DefIO for declaration.

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 : 3759

<< Prev        Next >>