<< 向前        下一页 >>

ID : 9085

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 命名规则. Also an 排列 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
单精度实数型 Single
双精度实数型 Double
字符串型 String
矢量型 Vector
位置型 Position
连接型 Joint
齐次变换型 Trans

Related Terms

Constant

Attention

I/O型 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 : 9085

<< 向前        下一页 >>