Page 1 of 1

":: try {throw}" still throws an error

Posted: 14 Apr 2024, 00:48
by ZhuangQu

Code: Select all

MButton:: try {
    throw
}
When we press MButton, it still throws an error unexpectedly.
For comparison, the following code are OK:

Code: Select all

MButton:: try throw

Re: ":: try {throw}" still throws an error

Posted: 14 Apr 2024, 06:54
by ZhuangQu
A similar problem is

Code: Select all

MButton:: loop 3 {
    MsgBox(A_Index)
}
does not work as expected. It shows 0 once.
My version is v2.0.12.

Re: ":: try {throw}" still throws an error

Posted: 14 Apr 2024, 22:24
by Panaku
You should pick between doing a single line or multi line. When you want a hotkey to run multiple lines of code, you need to open the brackets immediately after the key definition because Hotkeys act similar to functions, so you need to open a code block.

Single Line:

Code: Select all

MButton::MsgBox("Hello")
Multi-Line:

Code: Select all

MButton:: {
	Loop(3)
		MsgBox(A_Index)
}

Re: ":: try {throw}" still throws an error

Posted: 15 Apr 2024, 15:54
by ZhuangQu
You're right, but my code is still compilable and executable.
And at first glance, nothing seems wrong.
Should we report a syntax error?

Re: ":: try {throw}" still throws an error

Posted: 16 Apr 2024, 05:45
by boiler
It does seem worth reporting that this is not getting flagged as an error, although I think this thread adequately serves that purpose whether or not this would be considered a true bug.

Re: ":: try {throw}" still throws an error  Topic is solved

Posted: 07 May 2024, 06:54
by lexikos
Fixed by v2.0.14.