Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#3624 closed Bug (Wont Fix)

Ternary statement cannot be just an expression.

Reported by: genius257 Owned by:
Milestone: Component: Au3Check
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description

1==1?ConsoleWrite("yes"&@CRLF):ConsoleWrite("no"&@CRLF)
>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "...\script.au3" /UserParams    
+>16:27:33 Starting AutoIt3Wrapper v.2.1.0.33    Environment(Language:0409  Keyboard:00000406  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3
"...\script.au3"(1,56) : error: Statement cannot be just an expression.
1==1?ConsoleWrite("yes"&@CRLF):ConsoleWrite("no"&@CRLF)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
...\script.au3 - 1 error(s), 0 warning(s)
!>16:27:34 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 0    Time: 0.509

I've omitted script path from the output

It works when omitting the Au3Check #AutoIt3Wrapper_Run_Au3Check=N

Attachments (0)

Change History (5)

comment:1 Changed 6 years ago by Jpm

You right but I think that there will not be a solution as the way Au3check is implemented is difficult to analyse all AutoIt Syntax
I Will have a try but don't expect a solution
Sorry for not being able to fix it

comment:2 Changed 6 years ago by Melba23

Serious gopping syntax - why not write it correctly:

ConsoleWrite( ( (1 = 1) ? ("yes") : ("no") ) & @CRLF)

jpm, I would not waste your time trying to get Au3Check to deal with such an appalling construct. Much better to use your time on something useful.

M23

comment:3 Changed 6 years ago by Melba23

  • Resolution set to Wont Fix
  • Status changed from new to closed

comment:4 Changed 6 years ago by genius257

Thanks for the quick and very informative feedback jpm.
It's a small bug that properly will affect less than 1% i imagine.

And Melba23,
It was a quick way to provide one line of code that could illustrate the problem.
I mostly use ternary as a way to if else statements so it would be more like

#AutoIt3Wrapper_Run_Au3Check=N

$a = Random(0, 1, 1)
$b = Random(0, 1, 1)
$c = Random(0, 1, 1)

$a?a($c+1):$b?b($c*2):c($c/3)

Func a($a)
	ConsoleWrite("a"&@CRLF)
EndFunc

Func b($b)
	ConsoleWrite("b"&@CRLF)
EndFunc

Func c($c)
	ConsoleWrite("c"&@CRLF)
EndFunc

Anyway thanks for the time invested :) .

comment:5 Changed 6 years ago by Melba23

I am afraid I regard something like that as really bad coding practice - particularly the way you have it with absolutely no parentheses to help anyone else understand just what is going on. I pity anyone else who has to maintain your code if it is all like that. But if you are happy.....

M23

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.