Jump to content

Variable Problem


Recommended Posts

Why doesn't the value $iTemp show the values '1' to '3' when run? I've declared the variable as global, but it acts like it's only a local.

;--- Begin Script ---

Global $iTemp

One()

Func One()

For $iTemp = 1 to 3

Two()

Next

EndFunc

Func Two()

MsgBox(0, "", $iTemp)

EndFunc

;--- End Script ---

Thanks,

BionicBulldog

Link to comment
Share on other sites

  • Developers

Why doesn't the value $iTemp show the values '1' to '3' when run?  I've declared the variable as global, but it acts like it's only a local.

;--- Begin Script ---

Global $iTemp

One()

Func One()

For $iTemp = 1 to 3

  Two()

Next

EndFunc

Func Two()

MsgBox(0, "", $iTemp)

EndFunc

;--- End Script ---

Thanks,

BionicBulldog

<{POST_SNAPBACK}>

The variable used in a For...Next loop is dynamically declared with a Local scope....

(Maybe we need to say something about it in the Helpfile If functions page ??)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The variable used in a For...Next loop is dynamically declared with a Local scope....

(Maybe we need to say something about it in the Helpfile If functions page ??)

<{POST_SNAPBACK}>

Thanks for the info.

Glad to know I'm not crazy, well maybe I am, but not about this one issue...

:)

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...