Opened 2 years ago

Last modified 9 months ago

#3886 assigned Feature Request

Default keyword = -1 in expression — at Version 4

Reported by: Jpm Owned by: Jpm
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

Change History (4)

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)
Note: See TracTickets for help on using tickets.