Jump to content
Sign in to follow this  
BionicBulldog

Variable Problem

Recommended Posts

BionicBulldog

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

Share this post


Link to post
Share on other sites
Jos

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 ??)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
BionicBulldog

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

:)

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  

×