Opened on Apr 26, 2023 at 11:38:19 AM
Last modified on Feb 20, 2024 at 3:44:23 PM
#3953 assigned Bug
missing bracket error when using ternary operator inside array definition — at Version 3
| Reported by: | AspirinJunkie | Owned by: | J-Paul Mesnage |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.16.0 | Severity: | None |
| Keywords: | ternary bracket | Cc: |
Description (last modified by )
When using a ternary operator inside a direct array definition, an error is thrown at runtime when the if branch is applied:
; no error thrown Global $A = [ 1 > 2 ? 1 : 2 ] ; else path Global $A = [ 2 < 1 ? 2 : 1 ] ; else path Global $A = [ 1 <> 1 ? 1 : 2 ] ; else path Global $A = [ False ? 1 : 2 ] ; else path ; error "Missing right bracket ')' in expression." Global $A = [ 2 > 1 ? 2 : 1 ] ; if path Global $A = [ 1 < 2 ? 1 : 2 ] ; if path Global $A = [ 1 = 1 ? 1 : 2 ] ; if path Global $A = [ True ? 1 : 2 ] ; if path
A workaround would be to add a parenthesis around the expression.
Nevertheless, there seems to be a parsing problem here.
Change History (3)
comment:2 by , on Apr 27, 2023 at 9:47:46 AM
| Owner: | set to |
|---|---|
| Status: | new → assigned |
Thanks
Fix sent to Jon for next beta
comment:3 by , on May 3, 2023 at 11:15:19 PM
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.

Yep, that is why this comment is in the helpfile:
"