Modify

Opened 9 years ago

Closed 9 years ago

#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:1 Changed 9 years ago by mLipok

From the help file:

Conditionally chooses one of two responses based on the result of an expression.

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.

comment:2 Changed 9 years ago by anonymous

This is not an error for AutoIt, why this is an error for Au3check?

comment:3 Changed 9 years ago by Jpm

In this special case Au3Check make a little more than AutoIt as the statement as no meaning Nothing can be stored

comment:4 follow-up: Changed 9 years ago by anonymous

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 Changed 9 years ago by Jpm

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 in reply to: ↑ 4 Changed 9 years ago by Jos

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 Changed 9 years ago by Jos

  • Resolution set to No Bug
  • Status changed from new to closed

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.