Naming Constants

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

Constants provide meaningful names for values that cannot be changed while a script runs. User-defined constants are typically named using all uppercase letters, with underscores separating individual words in the constant (for example, NUMBER_OF_DEPARTMENTS or STATE_SALES_TAX). This formatting convention indicates that NUMBER_OF_DEPARTMENTS is a constant and thus cannot be changed at any point during the running of a script. Trying to change the value of a constant while a script is running results in an error. Because constants are not the same thing as variables, it makes sense to format their names in a different manner.

Scripting languages, automation objects, type libraries and other similar entities typically include intrinsic constants as well. For those intrinsic constants, follow the naming convention used in the language or object s documentation. For example, VBScript includes such intrinsic constants as VbGeneralDate (used in formatting dates) and VbAbortRetryIgnore (used in constructing message boxes). You should use these names rather than names such as VB_GENERAL_DATE.


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