VBScript statements


VBScript statements
1) Call Statement
Calls a Sub or Function procedure
Syntax:
Call Sub or Function procedure name (Arguments)
Note: Arguments are Optional
Example:
Call Login (UserID, Password)
Call Login (“gcreddy”, “abcd123”)

2) Const Statement

Declared Constants, these can be used to replace literal values

Syntax:

Const Constant Name = Value

Example:

Const City = “Hyderabad”, num =100, myDate = #10/10/2010#
Const UserId= “gcreddy123”

Note: we can declare multiple constants by using ,
If we take new line again we have to use Const Statement

3) Dim StatementDeclares Variables and allocates storage space

Syntax:

Dim Variable name

Example:

Dim City, num, x, y

Example2:
Dim a, b(4), c(), d(4, 5)

Note: In the above declaration,
a is Scalar Variable

b is Array Variable

c is Dynamic Array

d is Dimensional Array

4) Do…Loop Statement
Repeats a block of statements while condition is True, once condition meets False It comes out from the Loop

Syntax:

Do While Condition

Statements
———
———
———
Increment or Decrement
Loop

Or

Do

Statements
———
———
———
Increment or Decrement
Loop While Condition

Using Until Keyword

Repeats a block of statements Until condition becomes True

Syntax:

Do Until Condition

Statements
———
———
———
Increment or Decrement
Loop

Or

Do

Statements
———
———
———
Increment or Decrement
Loop Until Condition

 

 

Comments