Sign in to follow this  
Followers 0
DoctorX

Declaring local variables

3 posts in this topic

Here's a newbie-ish question, but I just ran into this problem:

I have been in the habit of declaring local variables inside their respective function, for example:

Global $Title = "Test"
msgbox (0, $title, "About to enter the Example Function")
ExampleFunc ("Example Function entered")

Func ExampleFunc ($text)
Local $text
msgbox (0, $title, $text)
EndFunc

With the release version of AutoIT, this was never a problem, but when I compile it with the beta version $text causes a problem, I guess because I am essentialy re-declaring it.

I assume this is just improper scripting etiquette on my part, and not a bug in the beta version. So should I instead be declaring all of my local variables at the very beginning of the script along with the global variables?

Like I said, kind of a newbie question, but when you do something a certain way for a while and don't have problems, you don't realize you may be doing something wrong.


-DRX

Share this post


Link to post
Share on other sites



Thank you!


-DRX

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0