Can anybody tell me what the following logic would do?
if ((intOne and intTwo) = intThree)
I've got a feeling it checks that either intOne or intTwo matches intThree, but I'd like to know for certain. Unfortunately Google doesn't seem to have much support at all when it comes to asp classic.
Thank you in a开发者_C百科dvance.
MSDN is pretty specific:
The And operator also performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:
... (truth table for AND follows)
So the expression bitwise-ANDs the first two ints, and then compares the result to the third int.
Here's the same evaluation in C, for comparison.
if( (intOne & intTwo) == intThree ) ...
As far as i know .. the 'and' operator in vbscript is a boolean operator .. which means intOne and intTwo should be expressions or values that result in boolean.
Wrong syntax i think ...
My VBScript is a bit rusty, but I would guess that the (intOne and intTwo)
section evaluates to true
. My thinking is that it's only checking if the vars exist.
If you want to achieve an either or, it would probably look more like:
If intOne = intThree OR intTwo = intThree Then
...
End If
If both need to be equal to intThree
then you would do
If intOne = intThree AND intTwo = intThree Then
...
End If
I don't think the syntax is correct, but the logic is saying if BOTH intOne and IntTwo equal intThree then ...
if intOne = intThree and intTwo = intThree
精彩评论