Code: Select all
y:="ur"
ur:=2, ur=mod(++ur,3) ; Works; ur=0
MsgBox %ur%
ur:=2, %y%=mod(++%y%,3) ; Error; ur=3?
MsgBox %ur%
ur:=2, %y%:=mod(++%y%,3) ; Works; ur=0
MsgBox %ur%
Code: Select all
y:="ur"
ur:=2, ur=mod(++ur,3) ; Works; ur=0
MsgBox %ur%
ur:=2, %y%=mod(++%y%,3) ; Error; ur=3?
MsgBox %ur%
ur:=2, %y%:=mod(++%y%,3) ; Works; ur=0
MsgBox %ur%
oh really?TAC109 wrote: The failing code uses valid, allowable syntax.
,
Comma (multi-statement) [v1.0.46+]. Commas may be used to write multiple sub-expressions on a single line. This is most commonly used to group together multiple assignments or function calls. For example: x:=1, y+=2, ++index, func(). Such statements are executed in order from left to right. Note: A line that begins with a comma (or any other operator) is automatically appended to the line above it. See also: comma performance.
In v1.0.46.01+, when a comma is followed immediately by a variable and an equal sign, that equal sign is automatically treated as an assignment (:=). For example, all of the following are assignments: x:=1, y=2, a=b=c.
Yes, that is probably causing the unexpected result.just me wrote:%y% isn't a variable, it's a reference.