Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003

Microsoft® Windows® 2000 Scripting Guide

« Previous | Next »   

Constants are defined in VBScript by using the Const statement followed by the name and value of the constant. When you define a constant, you must assign it a literal value; you cannot assign a value to a constant by using a variable, another constant, or a function. For example, the following code sample, which attempts to define a constant using the variable NumberOfDepartments, will generate an "Expected literal constant" error:

NumberOfDepartments = 20 Const NUMBER_OF_DEPARTMENTS = NumberOfDepartments

Instead, assign the constant the literal value 20:

Const NUMBER_OF_DEPARTMENTS = 20


 Send us your feedback « Previous | Next »   

Категории