Constant in VB.NET
Constant means fixed value. For example the value of the PI is fixed all the time it will never change. So we can declare such values as a constant.
Like variable constant can also be used to store data.
Constant has two important characteristics:
(1) Value of constant can not change during execution of the program.
(2) Constant processed faster as compared to variable.
How To Declare Constant in VB.NET
Constant can be declared using the const keyword.
Constant must be assigned value at the time of declaring it.
Const constant-Name [as DataType] = value
The DataType is optional means if you don’t specify the DataType for the constant then compiler will automatically determine the type of the constant from the value that assigned to it.
Const PI = 3.14
Const PI as double = 3.14