Thursday, December 25, 2008

Function Vs Sub:

Similiarities among them:
  1. They are public by default i.e. they are visible to all procedures in the script.
  2. They can manipulate their input arguments, if there are passed by reference.
  3. They can be recursive.
The only difference between them is unlike Sub, Function can return a value i.e. function can be used to assign a value to variable.
strValue = FnConcat(sArg1, sArg2)

Note: If you want to discard the return value from user defined function or any intrinsic functions like Abs, Sqr, etc, then use the syntax Call before them.
Call FnSetEnvironment("xp","IE")

No comments: