step887 Posted January 29, 2013 Share Posted January 29, 2013 I am building a debug function into my script, I only want this function to be called, if $debug = True.. So my question: do I an If Then statement like: If $debug = True Then debug('stuff') func debug($para1) msgbox(0,'',$para1) Endfunc or do I call the function everytime like and return if $debug is not True debug('stuff') func debug($para1) If Not $debug Then Return msgbox(0,'',$para1) Endfunc So my only concern would be performance.. if I am debugging, it could be called 1000s of times and it will not be calling a msgbox, it will logging to a file.. So which would better or does it not really matter? Link to comment Share on other sites More sharing options...
JohnOne Posted January 29, 2013 Share Posted January 29, 2013 I think the first option would be better "If $debug = True Then debug('stuff')" Only 1 boolean variable is always being checked, the second is always making a call to a function and checking the variable. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Mat Posted January 29, 2013 Share Posted January 29, 2013 Realistically you won't notice the overhead. DRY. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now