VBScript tutorial lesson 5 VBScript constants

Time:2022-5-26

VB tutorial > lesson 5 VBScript constants
What is a constant?

A constant is a meaningful name used in place of a number or string, and its value never changes. VBScript defines many intrinsic constants. For more information, see the VBScript language reference.

Create constant

You can use const statements to create user-defined constants in VBScript. Use const statement to create string or numeric constants whose names have certain meanings and assign them original values. For example:

Const mystring = “this is a string.”
Const MyAge = 49

Notice that the string text is enclosed between two quotation marks (“”). This is the most obvious way to distinguish between string constants and numeric constants. Date text and time text are contained between two pound signs (#). For example:

Const CutoffDate = #6-1-97#

It is best to use a naming scheme to distinguish between constants and variables. This avoids reassigning constants when running a script. For example, you can use “VB” or “con” as the prefix of constant names, or capitalize all letters of constant names. Separating constants from variables can avoid confusion when developing complex scripts.

Recommended Today

Use of PHP PDO preprocessing statements and transactions

catalogue Preprocessing statement function Transaction capability summary Preprocessing statement function Preprocessing statement is to prepare a statement to be executed, and then return a pdostatement object. Generally, we will use the execute () method of pdostatement object to execute this statement. Why is it called preprocessing? Because it allows us to call this statement multiple […]