SPUG: "Boolean" return values

Michael R. Wolf MichaelRWolf at att.net
Mon Oct 13 15:03:26 PDT 2008


Does anyone know the motivation for the return values from the boolean 
operators?

true  returns (numeric) 1
false returns (string)  ''

Why not just 0 and 1?  Why the mix of numeric and string?

Is it just one of those "hysterical" (i.e. historically funny) laws of 
unintended consequences?

Given that it's usually embedded in an 'if' or 'while' statement, I 
really don't care what the return values are, just as long as they work, 
but is there some clever use for this non-obvious choice of true and false?

Thanks...


More information about the spug-list mailing list