[thelist] [ASP] [if..then] How to use the OR operator

Howard Cheng howcheng at ix.netcom.com
Mon Nov 25 12:01:35 CST 2002

At 02:29 AM 11/25/2002 +0530, Madhu Menon wrote:
>That's because your code is actually getting parsed right to left, and so
>"q1 or q2" is evaluated first, which of course is not equal to i.

Actually, the = operator takes precedence over the OR operator, so the
reason i = q1 OR q2 doesn't work is because the q2 variable is not a boolean.

You can try it yourself, like:

Function Test(x, y, bool)
     If x = y Or bool Then
         Test = True
         Test = False
     End If
End Function

In PHP, a variable evaluates to true if it's not null, an empty string, or
0, so therefore the statement if (i == q1 || q2) will return true if i is
equal to q1 or if q2 is not null, not an empty string, and not zero.

Howard Cheng
http://www.howcheng.com/ <-- NEW!
howcheng at ix dot netcom dot com
AIM: bennyphoebe
ICQ: 47319315

More information about the thelist mailing list