If I understand correctly, you want to check if a value is a number, and execute the code if it’s NOT. If so, use IsNumber()
. For example:
$testVar = 1
If Not (IsNumber($testVar)) Then
MsgBox(0, "Title", "This code will not execute as the variable's a number.")
Else
MsgBox(0, "Title", "This code WILL execute since the variable is a number.")
EndIf
$testVar2 = "String"
If Not (IsNumber($testVar2)) Then
MsgBox(0, "Title", "This code WILL execute since the variable is NOT a number.")
Else
MsgBox(0, "Title", "This code will not execute as the variable's NOT a number.")
EndIf
If $testVar
IS a number, but that number is in quotes, it will be recognized as a string instead and execute (as it’s not a number).
0
solved In If Else condition if any number taken then it will show error.how it will be done in AUTOIT