Monday 30 December 2013

Procedures in VB Script


Procedures:

ü  is a series of statements, enclosed by the Sub and End Sub statements
ü  can perform actions, but does not return a value
ü  can take arguments
ü  without arguments, it must include an empty set of parentheses ()

Sub mysub()
  Print "my Sub Procedude"
End Sub

or

Sub mysub(argument1,argument2)
  Print "my Sub Procedure"
End Sub


To call a Sub, you will use Call statement by enclosing arguments (if any) in parentheses.
The Call statement is not necessary to call a Sub, but if you want to use Call statement (Recommended), you must enclose arguments (if any) in parentheses.

Call mysub(argument1,argument2)
You can call a Sub without using Call statement as well, but not recommended.

mysub argument1,argument2

No comments:

Post a Comment