B
Brad Pears
I have a function that includes an "optional" boolean parameter as the 2nd
(and last) parameter.
In one particular location, I am executing the function and have passed it a
"false" value. In every other instance where this function is executed - I
am not even passing the optional parameter because I want the value to be
"true".
I coded the function as follows...
Function TestFunc(parm1 as string, optional parm2 as boolean = true)
....
if parm2 then
some code
else
some code
endif
....
end function
What is happening is that even when I pass a "false" value to this optional
parameter, it is using the "true" value. I anticipated that the "true" value
would only be used when no "optional" parameter was passed and that when a
value of "false" is passed, it would use that. Is this not the case?
Am I going to have to modify ever line of code where this function is
executed (tons of places) to pass a value of either "true" or "false" to
resolve it? (thus removing the "optional" parameter and replacing with a
requried parameter)
Thanks,
Brad
(and last) parameter.
In one particular location, I am executing the function and have passed it a
"false" value. In every other instance where this function is executed - I
am not even passing the optional parameter because I want the value to be
"true".
I coded the function as follows...
Function TestFunc(parm1 as string, optional parm2 as boolean = true)
....
if parm2 then
some code
else
some code
endif
....
end function
What is happening is that even when I pass a "false" value to this optional
parameter, it is using the "true" value. I anticipated that the "true" value
would only be used when no "optional" parameter was passed and that when a
value of "false" is passed, it would use that. Is this not the case?
Am I going to have to modify ever line of code where this function is
executed (tons of places) to pass a value of either "true" or "false" to
resolve it? (thus removing the "optional" parameter and replacing with a
requried parameter)
Thanks,
Brad