Constants
Constants provide a way for representing an immutable value with an identifier. There could be situations in which your applications need to use the same value (which can be of any .NET type); therefore, it can be convenient to define an easy-to-remember identifier instead of a value. What would happen if such a value were a Long number? You declare constants as follows:
Const defaultIntegerValue As Integer = 123456789 Const aConstantString As String = "Same value along the application"
Constants are basically read-only fields that can be declared only at the module and class level or within a method and must be assigned with a value when declared. Constants within methods have public visibility by default, whereas constants at the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access