If var is digit
Digit does not accept periods (nor commas), so it works in identifying a value as an integer. However, you may want to incorporate it with another check for it to have a value, as otherwise a null value in the variable is also accepted.
Code: Select all
If !var
{
MsgBox %var% has no value or is false
ExitApp
}
If var is not digit
{
MsgBox %var% is not an integer
ExitApp
}
Unfortunately you can't combine the If var is (not) [type] command with a traditional If expression. You could probably do this though; I haven't tested it:
Code: Select all
If !RegExMatch(var,"$\d+^)
{
MsgBox %var% is not an integer
ExitApp
}
The RegEx here searches for \d characters -- digits 0 through 9. The + means one or more digits must be found. The first matching character must be at the start of the entire haystack, per the $; the last matching character must be at the end of the entire haystack, per the ^ -- in other words, the entire string must be digits throughout.