VB Script Constants
A constant is a meaningful name that takes the place of a number or string and never changes.

 Creating Constants

We create user-defined constants in VBScript using the Const statement. Using the Const statement, we can create string or numeric constants with meaningful names and assign them literal values.

Const statement

Declares constants for use in place of literal values.


Const MyString = "This is my string."

Const MyAge = 49

Const CutoffDate = #6-1-97#

Note that String literal is enclosed in quotation marks (" ").

Represent Date literals and time literals by enclosing them in number signs (#).

We declare multiple constants by separating each constant name and value with a comma. For example:

Const price= 100, city= “Hyderabad”, x= 27


Post a Comment