Modify

Opened 2 years ago

Last modified 9 months ago

#3886 assigned Feature Request

Default keyword = -1 in expression

Reported by: Jpm Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description (last modified by mLipok)

It can be coherent that Default keyword act as -1.
This is coherent with the default in AutoIt builtin function which is -1.
It allows to just check -1 instead of -1 or Default

just use at the following script

Local $vKeyword = Default
ConsoleWrite('$vKeyword = ' & $vKeyword & @CRLF)
Local $iInt = Int($vKeyword)
ConsoleWrite('$iInt = ' & $iInt & @CRLF)

ConsoleWrite(@CRLF & "No Other display if OK, checking comparison with integers" & @CRLF & @CRLF)

If $vKeyword <> Default Then ConsoleWrite('$vKeyword is NOT Default' & @CRLF)
If $vKeyword <> -1 Then ConsoleWrite('$vKeyword is NOT -1' & @CRLF)

If $vKeyword <> Int(-1) Then ConsoleWrite('$vKeyword <> Int(-1)' & @CRLF)
If $vKeyword <> Int(-1, 2) Then ConsoleWrite('$vKeyword <> Int(-1, 2)' & @CRLF)

If Int(-1) <> $vKeyword Then ConsoleWrite('Int(-1) <> $vKeyword' & @CRLF)
If Int(-1, 2) <> $vKeyword Then ConsoleWrite('Int(-1, 2) <> $vKeyword' & @CRLF)


Local $bRet = f(Default)
If Not $bRet Then ConsoleWrite('f(Default) is NOT True' & @CRLF)

Func f($vPar = Default)
;~      If $vPar = Default Then Return True ; no need to check -1 and Default
        If $vPar = -1 Then Return True
        Return False
EndFunc

Attachments (0)

Change History (5)

comment:1 Changed 2 years ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

Fix sent to Jon

comment:2 Changed 2 years ago by Jpm

  • Type changed from Bug to Feature Request

comment:3 Changed 2 years ago by TicketCleanup

  • Version 3.3.14.0 deleted

Automatic ticket cleanup.

comment:4 Changed 2 years ago by mLipok

  • Description modified (diff)

comment:5 Changed 9 months ago by Jpm

  • Owner changed from Jpm to Jon

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 assigned The owner will remain Jon.
Author


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

 
Note: See TracTickets for help on using tickets.