Micro Focus QTP (UFT) Forums

Full Version: Default values in Functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
That's disappointing that it does not support it. Oh well. Thank you for the response.