[v2.076] Error - The following reserved word must not be used as variable name Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2.076] Error - The following reserved word must not be used as variable name  Topic is solved

16 Oct 2016, 15:56

???

That did not work. The break at the end was a variable reference which had no effect. Detecting these silly mistakes is exactly the reason "break" is now a reserved word.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [v2.076] Error - The following reserved word must not be used as variable name

16 Oct 2016, 17:36

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
In v2.076 this still works fine, but not for multiple statements where you get the error:

Code: Select all

Loop 100
	if A_Index=10 && var:=A_Index,break
MsgBox % var
Drugoy
Posts: 48
Joined: 11 Jun 2016, 07:37
Contact:

Re: [v2.076] Error - The following reserved word must not be used as variable name

16 Oct 2016, 18:38

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
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.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2.076] Error - The following reserved word must not be used as variable name

16 Oct 2016, 22:35

HotKeyIt, check your facts.

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.
Global Variables (alphabetical)
--------------------------------------------------
A_Args: Object(0x00000000005092C0)
break[0 of 0]:
ErrorLevel: 0
v[16 of 63]: 2.0-a075-02fab78
var: 10
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.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Bassman002, hisrRB57 and 43 guests