I can shed some light on this.
First thing, I think you need something to follow the IF test, before the ELSE... try throwing a comment in there.
Secondly, in many programming languages, logic tests are short-circuited... which is to say, if the first argument needs to be true, but isn't, then nothing else is tested. And you can extrapolate that short-circuit behavior on and on... if an argument fails its test, nothing further is tested... in many programming languages.
So, Vid's statement would be fine... except TWX scripts DO NOT short-circuit logic tests. So let's recap:
> isNumber $yn $number
> if ($yn =TRUE) AND ($value > 0)
So indeed, the first argument fails if it's not a number... but the second comparison will still be attempted, and throw an exception if $value isn't a number. Make sense? I tried to alter this behavior, but it was non-trivial, and I don't think I succeeded.
So, you have to nest any comparisons that require a number inside of the isNumber test:
Code:
isNumber $yn $number
if ($yn = TRUE)
if ($value > 0) // now it's safe, we verified it
echo "Mathematical!!"
end
end
Cruncher, why wouldn't you want the number zero to pass the isNumber test? You may be creating the zero just by testing a value. Share more, and I'll elaborate if it applies.
+EP+