Jump to content

Declaring local variables

Recommended Posts

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)

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.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...