Link to home
Start Free TrialLog in
Avatar of hardrock95
hardrock95

asked on

vbscript test boolean variable that is function name

Below is my code, how do I test the function name for true or false?  "If A = True" does not work.  Many thanks for any help.

Function A  
   A=true
End Function
Avatar of leonstryker
leonstryker
Flag of United States of America image

Ok, why are you testing the 'function name'? Shouldn't you passing a variable into a function to test?
Avatar of hardrock95
hardrock95

ASKER

I inherited the code.   Is that poor coding practice?
All the above does is assign true to A. Its basically a global constant.  What is this used for?
So, can it be tested for true or false?
From a different place, yes. Something like this:

If A = true Then
   msgbox "Its True!"
Else
  msgbox "Not working!"
End if

Function A  
   A=true
End Function
I tried that and it does not work.  Please see original post.
ASKER CERTIFIED SOLUTION
Avatar of leonstryker
leonstryker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That works for me also. Not sure what my issue was.  I am going to close this and indicate you gave the answer.
Thanks a bunch.
Solution by leonstryker