Variable Initialization

Visual Basic allows you to initialize variables in the same line that declares them. The following statement declares an Integer variable and immediately places the value 3,045 in it:

Dim distance As Integer = 300

This statement is equivalent to the following two:

Dim distance As Integer
distance = 300

It is also possible to declare and initialize multiple variables (of the same or different type) on the same line:

Dim age As Integer = 85, pensionRate As Single = 0.25