Code: Select all
Loop 1
if A_Index=1,var:=A_Index,break
Code: Select all
Loop 1
if A_Index=1,var:=A_Index,break
Code: Select all
Loop 100
if A_Index=10,var:=A_Index,break
MsgBox % var ; var = 10
Code: Select all
Loop 100
if A_Index=10 && var:=A_Index,break
MsgBox % var
How do you know it did break? This example doesn't prove anything, as var gets a value only if if A_Index=10 is true. The next 90 rounds of the loop won't ever reassign the var.HotKeyIt wrote:In this case it is the command break and in v2.075 it did break properly:Code: Select all
Loop 100 if A_Index=10,var:=A_Index,break MsgBox % var ; var = 10
Code: Select all
ListLines On
Loop 100
if A_Index=10,var:=A_Index,break
v := A_AhkVersion
ListLines
Pause
ListVars
Pause
003: Loop,100
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: if A_Index=10
004: var:=A_Index,break
004: if A_Index=10
004: if A_Index=10
... (many identical lines omitted) ...
004: if A_Index=10
004: if A_Index=10
006: v :=
007: ListLines
Press [F5] to refresh.
if expression, statement does not support multiple statements. However, it does support a single statement which is an expression containing the comma operator. An expression cannot contain a break statement and never could.Global Variables (alphabetical)
--------------------------------------------------
A_Args: Object(0x00000000005092C0)
break[0 of 0]:
ErrorLevel: 0
v[16 of 63]: 2.0-a075-02fab78
var: 10
Users browsing this forum: garry and 39 guests