Modify ↓
Opened 3 years ago
Last modified 2 years ago
#3953 assigned Bug
missing bracket error when using ternary operator or OR operator inside array definition
| Reported by: | AspirinJunkie | Owned by: | Jon |
|---|---|---|---|
| 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.
Attachments (0)
Change History (7)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
Thanks
Fix sent to Jon for next beta
comment:3 by , 3 years ago
| Description: | modified (diff) |
|---|
comment:4 by , 3 years ago
Info (if this isn't already part of the fix):
Global $a = [1 And 2] ; I'm ok :) Global $b = [1 Or 2] ; I'm not ok :(
comment:5 by , 3 years ago
| Summary: | missing bracket error when using ternary operator inside array definition → missing bracket error when using ternary operator or OR operator inside array definition |
|---|
Thanks
That's another pb not related with ternary operator
comment:7 by , 2 years ago
| Owner: | changed from to |
|---|
Note:
See TracTickets
for help on using tickets.

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