Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

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
0
hardrock95
Asked:
hardrock95
  • 5
  • 4
1 Solution
 
leonstrykerCommented:
Ok, why are you testing the 'function name'? Shouldn't you passing a variable into a function to test?
0
 
hardrock95Author Commented:
I inherited the code.   Is that poor coding practice?
0
 
leonstrykerCommented:
All the above does is assign true to A. Its basically a global constant.  What is this used for?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hardrock95Author Commented:
So, can it be tested for true or false?
0
 
leonstrykerCommented:
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
0
 
hardrock95Author Commented:
I tried that and it does not work.  Please see original post.
0
 
leonstrykerCommented:
Works for me no problem. Please tell me more about your environment and how you are running the code.  

The easiest way to test this is copy the code above into a blank file and save it as Test.vbs. You can run it by double clicking the that file.
0
 
hardrock95Author Commented:
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.
0
 
hardrock95Author Commented:
Solution by leonstryker
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now