' Declare a one-dimensional Integer array and a Single
' variable.
Dim philaMint(5) As Integer
Dim x As Single
x! = 10.0
philaMint%(0) = 3 ' Assigns an Integer value
philaMint%(1) = x ' Converts Single 10.0 to Integer 10
Print DataType(philaMint%(0)); DataType(philaMint%(1))
' Output:
' 2 2
' Both values are Integers.
Dim xB As New Button("Merge", 60, 125)
xB は、Button という名前のクラスのオブジェクトを参照する値を持ったオブジェクト参照変数として宣言されます。新しい Button オブジェクトが作成されます。この例では、Button クラスのコンストラクタサブルーチンが 3 つの引数 (ボタンの名前、ボタンの位置の x 位置座標と y 位置座標) をとると仮定します。(60, 125) の位置にある「Merge」という名前の新しいボタンが作成されます。このボタンへの参照が xB に代入されます。
' Declare iVer and kVer as Integer variables. Note that
' the phrase As Integer must be repeated to declare both
' variables as Integer.
Dim iVer As Integer, kVer As Integer
' Declare nVer as an Integer variable.
' The declared type of mVer is Variant, the default
' data type, because no data type is declared for mVer:
' there is no As type phrase for mVer, and no data type
' suffix attached to mVer.
Dim mVer, nVer As Integer
Print TypeName(mVer), TypeName(nVer%) ' Prints EMPTY INTEGER
' Declare marCell and perDue as Integer variables.
' The phrase As Integer declares marCell as an Integer
' variable. The data type suffix % declares perDue as an
' Integer variable.
Dim marCell As Integer, perDue%
Print TypeName(marCell), TypeName(perDue%) ' Prints INTEGER INTEGER
Dim marCell% As Integer
' Error, because the Dim statement attempts to declare
' the Integer variable marCell using both the data type
' suffix character for Integer, and the data type name
' Integer. The declaration should include one or the
' other, but not both.
' A data type suffix character is optional in references to a
' declared variable.
' Declare marCell as an Integer variable.
Dim marCell As Integer
' Use the data type suffix character in a reference to marCell.
marCell% = 1
' Refer to marCell without using the suffix character.
Print marCell ' Prints 1
' Declare marCell as an Integer variable.
Dim marCell As Integer
' Assign integer value to marCell.
marCell% = 1
Print marCell$
' Error, because the Print statement refers to marCell
' using the data type suffix character $ for a String
' variable, but marCell was declared as an Integer.
Dim db As New NotesDatabase ("Server003", "discuss.nsf")
この Dim objRef As New prodClass(argList) ステートメントは、Notes/Domino の NotesDatabase クラスへのオブジェクト参照を宣言し、そのインスタンスを作成します。NotesDomino オブジェクトを作成するための Dim ステートメントには、2 つの文字列引数 (サーバー名とデータベースパス名) が必要です。