开发者

Logical and bitwise operators VB

开发者 https://www.devze.com 2023-03-27 01:13 出处:网络
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 o

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消