-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable Initialization with postfix #319
Comments
Autohotkey v2 will throw a warning with the first function. You must assign a number before using the
On the other hand:
Try it. :) So the lexer is correctly warning you of the problem. If it doesn't it is really unexpected for me because everything in the documentation is clear about trying to use empty variables. |
Yes it seems for good reason that version 2 requires variables to be explicitly declared before we can perform any arithmetic function on them. |
Being a postfix operator isn't: So it is initialized, then incremented |
I just tried Your examples on v2 and I do not get a warning when running the code which is highly unexpected. So you are right, assignment seems to happen before the increment which is very weird looking at how the code is read from left to right 😆 |
Seems like I have the same issue. Every first variable that WingetPos/MouseGetPos asked get a warning. This showcase from documentation have 5 warnings:
Every first "X" like |
@rebornsick Yes, similar issue, |
Perfect, thank you! |
; Below will flag a warning about index not being assigned a value
dummyFunction1() {
someArray := Array()
index++ := someArray.Length
}
; Below works fine
dummyFunction2() {
someArray := Array()
index := someArray.Length
}
Either is valid syntax wise
The text was updated successfully, but these errors were encountered: