What Are Coding Conventions?

VBScript Coding Conventions?

Coding conventions are suggestions that may help you write code using Microsoft Visual Basic Scripting Edition. Coding conventions can include the following:

  1. Naming conventions for objects, variables, and procedures
  2. Commenting conventions
  3. Text formatting and indenting guidelines

The main reason for using a consistent set of coding conventions is to standardize the structure and coding style of a script or set of scripts so that you and others can easily read and understand the code. Using good coding conventions results in precise, readable, and unambiguous source code that is consistent with other language conventions and as intuitive as possible.

Constant Naming Conventions

Earlier versions of VBScript had no mechanism for creating user-defined constants. Constants, if used, were implemented as variables and distinguished from other variables using all uppercase characters. Multiple words were separated using the underscore (_) character. For example:


While this is still an acceptable way to identify your constants, you may want to use an alternative naming scheme, now that you can create true constants using the Const statement. This convention uses a mixed-case format in which constant names have a "con" prefix. For example:


Variable Naming Conventions

For purposes of readability and consistency, use the following prefixes with descriptive names for variables in your VBScript code.

Subtype Prefix Example
Boolean bln blnFound
Byte byt bytRasterData
Date(Time) dtm dtmStart
Double dbl dblTolerance
Error err errOrderNum
Integer int intQuantity
Long lng lngDistance
Object obj objCurrent
Single sng sngAverage
String str strFirstName

Post a Comment


shahdkhan said…
check all updates about notepad from Notepad Updates