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

Report problems with documented functionality
ZhuangQu
Posts: 30
Joined: 06 Feb 2022, 20:54

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

14 Apr 2024, 00:48

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
Last edited by ZhuangQu on 14 Apr 2024, 06:59, edited 1 time in total.
ZhuangQu
Posts: 30
Joined: 06 Feb 2022, 20:54

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

14 Apr 2024, 06:54

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.
Panaku
Posts: 22
Joined: 02 Apr 2022, 17:24

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

14 Apr 2024, 22:24

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)
}
ZhuangQu
Posts: 30
Joined: 06 Feb 2022, 20:54

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

15 Apr 2024, 15:54

You're right, but my code is still compilable and executable.
And at first glance, nothing seems wrong.
Should we report a syntax error?
User avatar
boiler
Posts: 16996
Joined: 21 Dec 2014, 02:44

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

16 Apr 2024, 05:45

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.

Return to “Bug Reports”

Who is online

Users browsing this forum: JoeWinograd and 9 guests