VB Tutorial > Fifth Class VBScript constant
What is a constant?
A constant is a name that has a meaning, used in place of a number or string, and its value never changes. VBScript defines a number of intrinsic constants. For more information, see the VBScript Language Reference.
Creating constants
You can use the Const statement to create user-defined constants in VBScript. Use the Const statement to create a string or numeric constant with a certain meaning to the name, and to assign them a literal value. For example:
Const MyString = "This is a string. "
Const Myage = 49
Note that the string literal is contained between two quotes (""). This is the most obvious way to differentiate between string and numeric constants. The date text and time text are contained between two pound numbers (#). For example:
Const cutoffdate = #6 -1-97#
It is best to use a naming scheme to differentiate between constants and variables. This avoids the value being assigned to the constant when the Script is run. For example, you can use either "VB" or "con" as the prefix for a constant name, or capitalize all the letters of a constant number. Separating constants from variables can avoid clutter when developing complex Script.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.