Variables

Top  Previous  Next

Each variable must be declared with the DIM directive, it's not required to define the data type.

 

The datatype is determined automatically when you assign a value to a variable the first time. Using the datatype in the declaration doesn't assign the data type to the variable, this happens with the first assignment.

 

Variables can be default initialized with the following syntax:

Dim x = value

 

Examples:

Dim i, j

Dim s

 

Dim n = 4

Dim s2 = "some text"

Dim s3 As String = "another text"

 

= 13

= i * i

= "This is a string"

 

 




Translate document: