Jump to content

Declaring a global variable


Recommended Posts

I am using the string split function to create an array from a string.

$commands = StringSplit ( $command, " ", 1)

It works fine, but in my other functions when I try to use this array I get an error for using a variable before it is declared. I tried this but it did not fix it.

global $commands = StringSplit ( $command, " ", 1)

Any ideas? I know the solution will be really simple, but oh well....

Link to comment
Share on other sites

  • Moderators

Is $command already global? If not, you're trying to use it in a local scope within a function, and the value isn't passed.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...