VBS Tutorial: VBScript basics-VBScript constant

Source: Internet
Author: User

VBScript constant

A constant is a name with a certain meaning. It is used to replace a number or string, and its value never changes. VBScript defines many internal constants. For more information, see the VBScript language reference.

Create constant

You can use the Const statement to create user-defined constants in VBScript. UseConstStatements can create string or numeric constants with specific meanings and assign them original values. For example:

Const MyString ="This is a string."Const MyAge = 49

Note that the string text is contained between two quotation marks. This is the most obvious way to distinguish between string constants and numeric constants. The date text and the time text are included in the interval between two periods. For example:

Const CutoffDate = #6-1-97 #

It is best to use a naming scheme to distinguish between constants and variables. This avoids re-assigning values to constants when running scripts. For example, you can use "vb" or "con" as the prefix of the constant name, or capital all the letters of the constant name. Separating constants and variables can avoid confusion when developing complex scripts.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.