Micro Focus QTP (UFT) Forums
Default values in Functions - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Default values in Functions (/Thread-Default-values-in-Functions)



Default values in Functions - XeNoMoRpH - 06-30-2009

I have tried a few ways to get a default value when you call a function, of which all have failed.

I first tried overloading, which as nothing to do with the default value, but it what I really wanted to do. That didn't work.

I tried using the following which also did not work.
Code:
Function testFunc(ByVal testvar As int = 1)
and
Function testFunc(ByVal testvar = 1)
I'm not really sure if it's possible.


RE: Default values in Functions - Anshoo Arora - 06-30-2009

Unfortunately VBScript does not support function or operator overloading.. What you're trying to do did not work either because VBScript also does not support default parameters.


RE: Default values in Functions - XeNoMoRpH - 06-30-2009

That's disappointing that it does not support it. Oh well. Thank you for the response.