Using VBScript Statements

Data types aren’t the only things missing. VBScript also lacks several statements. It’s missing all of the statements related to file I/O, such as OpenCloseRead, and Input. Other statements that are not available are WriteGoSubOn GoSubOn GoToOn Error, and DoEvents. Table 13.5 contains a complete list of all of the available VBScript statements.

Table 13.5: Statements Supported in VBScript

StatementDescription
CallInvokes a subroutine
ConstDeclares a constant value
DimDeclares variables
Do/LoopExecutes a loop until a condition or while a condition is True
EraseReinitializes the contents of a fixed-size array and frees all of the memory allocated to a variable-sized array
For/NextExecutes a loop while iterating a variable
For Each/NextExecutes a loop while iterating through a collection of objects
Function/End FunctionDeclares a routine that will return a value
If/Then/Else/End IfConditionally executes one set of statements or another
On ErrorTakes the specified action if an error condition arises
Option ExplicitRequires that all variables must be declared before their use
PrivateDeclares private variables
PublicDeclares public variables
RandomizeInitializes the random-number generator
ReDimChanges the size of an array
Select Case/End SelectChooses a single condition from a list of possible conditions
SetAssigns a reference to an object or creates a new object
SubDeclares a subroutine
While/WendExecutes a loop while a condition is True


+ Recent posts