I kept getting an error in my program when it would check for the state of a button. So, I tested something…
set foo to 1
if foo then
display dialog "True!"
end if
I get an error saying it can’t turn 1 into a boolean.
Seriously? I never noticed this before, and it completely floors me. I’m pretty sure this makes AppleScript the only language in the history of computer programming where true and false do not equal 1 and 0.
Hmm. I suppose for a strongly typed language like AppleScript, it would make more sense to require implicit casting this way. I’m just so used to C and PHP, that it baffled me that it didn’t automatically consider non-zero as true.