Jump to content
Sign in to follow this  
xap

Is a bug ?

Recommended Posts

xap

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

Share this post


Link to post
Share on other sites
Jos

No Bug.

Remarks

The Variable will be created automatically with a LOCAL scope, even when MustDeclareVars is on.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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
Jos

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 by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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
xap

Ok, Thanks for the replies

Share this post


Link to post
Share on other sites
Jos

didnt see your post when i started typing :blink: 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. :P

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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

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  

×