Variables are named entities used to store data.
Variables are used to store data.
The name of a variable must begin with an alphabetic character and cannot contain whitespace or reserved characters.
A variable can be of a specific type, indicating the kind of data it stores. String variables store string values ("Welcome to mytat"), integer variables store number values (103), date variables store date values, etc.
Variables are declared using the Dim keyword, or by using the type (if you want to declare the type), but ASP.NET can usually determine data types automatically.
Examples
// Using the Dim keyword:
Dim greeting = "Welcome to mytat"
Dim counter = 103
Dim today = DateTime.Today
// Using data types:
Dim greeting As String = "Welcome to mytat"
Dim counter As Integer = 103
Dim today As DateTime = DateTime.Today
Dim greeting = "Welcome to mytat"
Dim counter = 103
Dim today = DateTime.Today
// Using data types:
Dim greeting As String = "Welcome to mytat"
Dim counter As Integer = 103
Dim today As DateTime = DateTime.Today
Practice Excercise Practice now