xap Posted August 10, 2010 Share Posted August 10, 2010 try this, it work fine: Global $I ;go() ;Func go() For $I=1 to 4 sub() Next ;EndFunc Func sub() consolewrite($I) EndFunc Now, remove ';'. It fail. Is a bug ?test.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted August 10, 2010 Developers Share Posted August 10, 2010 (edited) No Bug.RemarksThe Variable will be created automatically with a LOCAL scope, even when MustDeclareVars is on. Edited August 10, 2010 by Jos 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 More sharing options...
Zibit Posted August 10, 2010 Share Posted August 10, 2010 perfect your code. Global $I = 0 go() Func go() For $I=1 to 4 sub() $I = $I + 1 Next EndFunc Func sub() consolewrite($I & @CRLF) EndFunc first the I wasnt declared as anything. second you didnt add $i = $i + 1 in your loop. Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Link to comment Share on other sites More sharing options...
Developers Jos Posted August 10, 2010 Developers Share Posted August 10, 2010 (edited) first the I wasnt declared as anything. second you didnt add $i = $i + 1 in your loop. Are you sure ? The for..next loop will add 1 to the variable and there is a Global statement in the OP's post. anyway, my previous post gave the answer to the issue and to fix the code: Global $I go() ; Func go() For $I = 1 To 4 sub($I) Next EndFunc ;==>go ; Func sub($i) ConsoleWrite($I) EndFunc ;==>sub Edited August 10, 2010 by Jos 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 More sharing options...
Zibit Posted August 10, 2010 Share Posted August 10, 2010 didnt see your post when i started typing you wrote your post when i was writing mine Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Link to comment Share on other sites More sharing options...
xap Posted August 10, 2010 Author Share Posted August 10, 2010 Ok, Thanks for the replies Link to comment Share on other sites More sharing options...
Developers Jos Posted August 10, 2010 Developers Share Posted August 10, 2010 didnt see your post when i started typing you wrote your post when i was writing mine That wasn't my point. The point is that you make two statements in your answer that are simply wrong. 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 More sharing options...
Zibit Posted August 10, 2010 Share Posted August 10, 2010 ok i'll just.. shut up now... Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now