Solved

vbscript test boolean variable that is function name

Posted on 2015-01-22
9
154 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

Author Comment

by:hardrock95
ID: 40565142
So, can it be tested for true or false?
0
 
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

689 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