On Thu, 20 Dec 2001 19:00:30 +0100, Philip Newton wrote:
>On Thu, 13 Dec 2001 10:50:11 -0500, [EMAIL PROTECTED]
>(Ronald J Kimball) wrote:
>
>> (y/a-zA-Z// > 2) & (y/0-9// > 1)
>>
>> Each numeric comparison will return either 1 or 0.
>
>In my experience, 1 or "", rather than 1 or 0. Or is FALSE (PL_NO?) a
>special value which looks like 0 to operators that care, such as
>bitwise-and?
and arithmetical operators, yes. Note that
(2>3)+1
doesn't produce a warning. So (2>3) is both a string ("") and a number
(0). Bitwise operators appear to treat it as a number.
String:
print ~"";
-->
(empty string)
Number:
print ~0
-->
4294967295
(long integer, 0xFFFFFFFF)
boolean:
print +(2>3);
-->
(as string, it's an empty string)
print ~(2>3);
-->
4294967295
(so it's a number: 0)
--
Bart.