I am trying to write a function that has a parameter “Identical” that is a boolean. I want the default to be false, so I am using an “If…Do” block and using a “NOT” block to invert the boolean. It returns true for Identical=NULL and false for Identical =TRUE. This is what I would expect and want, but it is returning False for Identical=FALSE. Why would this be? Shouldn’t not false be true?
I narrowed it down. I recreated just that portion of the function in a new function and everything worked perfectly except for when I set the parameter to Any Object and pass an empty object. I then went back to the original function and rearranged my “If…Do” block and it works except for an empty object. But I can live with that.
Is there a better way to set a default for a parameter in a custom function?
What I ended up doing is creating a variable “isIdentical” and setting it to false. I then created a “If…Do” block that changed it to true only if the parameter Identical was true. I then used the new variable for all the rest of the logic. That should handle all possibilities.
Glad you got it working!