1. Create a new project for the variable declaration experiment by clicking "File" and "New Project." Choose the "Console Application" option, since it is the simplest to create a basic program in.
2. Declare a variable by pasting the following code:Dim s as StringThis defines a String (a collection of letters, numbers and punctuation marks). Notice, variable definitions begin with the "dim" keyword, are followed by the variable name, followed by "as" and the data type to be used.This example merely declares the variable; it does not initialize it. Attempting to use this variable now would produce an error.
3. Declare and initialize a variable:Dim s as String = "Hello."This is the same as the previous command, except s is given an initial value of "Hello" as soon as it is declared.
4. Paste the following shortcut:Dim s = "Hello."When assigning an initial value, or initializing the variable, it is not necessary to specify a type for the variable using the "as" command. However, it is generally a good idea to do so, simply to increase the readability of the code.