Data Types and Control Structures
VBScript has only one data type—variant—that is capable of storing different types of data (e.g., strings, integers, floating-point numbers etc.). The data types (or variant subtypes) a variant stores are listed in Fig. 24.4. VBScript interprets a variant in a manner that is suit-able to the type of data it contains. For example, if a variant contains numeric information, it will be treated as a number; if it contains string information, it will be treated as a string.
Variable names cannot be keywords and must begin with a letter. The maximum length of a variable name is 255 characters containing only letters, digits (0–9) and underscores. Variables can be declared simply by using their name in the VBScript code. The statement Option Explicit can be used to force all variables to be declared before they are used.
Notice that the Select Case/End Select structure does not require the use of a statement like break. One Case cannot accidentally run into another. The VBScript Select Case/End Select structure is equivalent to VBScript’s If/Then/Else/End If multiple selection structure. The only difference is syntax. Any variant subtype can be used with the Select Case/End Select structure.
The Exit Do statement, when executed in a Do While/Loop, Do/Loop While, Do Until/Loop or Do/Loop Until, causes immediate exit from that structure. The fact that a Do While/Loop may contain Exit Do is the only difference, other than syntax, between Do While/Loop and While/Wend. Statement Exit For causes immediate exit from the For/Next structure. With Exit Do and Exit For, program execution con-tinues with the first statement after the exited repetition structure.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.