#3200 closed Bug (No Bug)
Ternary operator for functions
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | Au3Check | |
| Version: | 3.3.14.2 | Severity: | None |
| Keywords: | Ternary | Cc: |
Description
It looks like Au3Check error, because AutoIt runs this script without errors
$v = 0 $v ? _F1() : _F0() Func _F1() MsgBox(0, "", 1) EndFunc Func _F0() MsgBox(0, "", 0) EndFunc
>Running AU3Check (3.3.14.2) from:d:\AutoIt3 input:D:\test.au3 "D:\test.au3"(2,19) : error: Statement cannot be just an expression. $v ? _F1() : _F0() ~~~~~~~~~~~~~~~~~~^ D:\test.au3 - 1 error(s), 0 warning(s) !>17:39:20 AU3Check ended. Press F4 to jump to next error.rc:2
Attachments (0)
Change History (7)
comment:2 by , on Jan 14, 2016 at 4:32:28 PM
This is not an error for AutoIt, why this is an error for Au3check?
comment:3 by , on Jan 15, 2016 at 8:48:50 AM
In this special case Au3Check make a little more than AutoIt as the statement as no meaning Nothing can be stored
follow-up: 6 comment:4 by , on Jan 15, 2016 at 9:34:47 AM
I don't need "a little more". I need like AutoIt. No more.
If you need "a little more", please, add the option.
comment:5 by , on Jan 15, 2016 at 10:23:10 AM
Au3Check flag Something meaninless
AutoIt produce error if invalid
In this case it can be legal if for instance a function is called changing for instance a global variable or a byref variable.
In this case a dummy variable to store the result of the ternary operation will be needed to have a really working script
comment:6 by , on Jan 15, 2016 at 8:25:07 PM
Replying to anonymous:
I don't need "a little more". I need like AutoIt. No more.
If you need "a little more", please, add the option.
Please simply do not use au3check in case you really feel this strong about it.
Jos
comment:7 by , on Jan 15, 2016 at 8:25:40 PM
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |

From the help file:
Where you store the responses ?
Your example is correct when it comes to that AutoIt offer such a possibility.
It is also not correct when it comes to assumptions as to the use of Ternary Operators as such.