Defining Constants

Microsoft® Windows® 2000 Scripting Guide

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 Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net