Solved

vbscript test boolean variable that is function name

Posted on 2015-01-22
9
132 Views
Last Modified: 2015-01-23
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
Comment
Question by:hardrock95
  • 5
  • 4
9 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 40564854
Ok, why are you testing the 'function name'? Shouldn't you passing a variable into a function to test?
0
 

Author Comment

by:hardrock95
ID: 40564996
I inherited the code.   Is that poor coding practice?
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 40565110
All the above does is assign true to A. Its basically a global constant.  What is this used for?
0
 

Author Comment

by:hardrock95
ID: 40565142
So, can it be tested for true or false?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 29

Expert Comment

by:leonstryker
ID: 40565323
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
 

Author Comment

by:hardrock95
ID: 40566233
I tried that and it does not work.  Please see original post.
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 500 total points
ID: 40566364
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
 

Author Comment

by:hardrock95
ID: 40566829
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
 

Author Closing Comment

by:hardrock95
ID: 40566833
Solution by leonstryker
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hasOne  challenge 59 91
countHi challenge 25 84
array220 challenge 8 47
Installed softare without GUID 6 54
This article will show, step by step, how to integrate R code into a R Sweave document
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now