Opened 2 years ago

Last modified 9 months ago

#3886 assigned Feature Request

Default keyword = -1 in expression — at Initial Version

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

Description

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 (0)

Note: See TracTickets for help on using tickets.