According to MSDN The And
operator can act as a bitwise operator OR a logical operator.
The only way to know if it is used as One operator or another is, If it is on the right side of an assignment operation? for example x = 3 AND 5
. I cannot find any other instances where the bitwise operator开发者_JS百科 would be used instead of the logical operator, are there? Thank you for you help.
Update: I guess you can do it inline if you needed to
Response.Write(CLng("3") And CLng("4"))
It is a logical operator when the operands are both of type Boolean. Bitwise operator in any other case, albeit that I'm not trying to think of Nothing. Also consider OrElse
and AndAlso
, they are always logical and do short-circuit evaluation.
精彩评论