Asp.net boolean operator

Source: Internet
Author: User
The logical (Boolean) operator is used to calculate the expression of the result of the boolean type. The result of the operation is boolean type. The calculation result is as follows:

Operator Operation Example Result
& And (and) False & True False
| Or (OR) False | true True
^ XOR (exclusive or) False ^ true True
! Not (not) ! False True
&& And (Short Circuit) False & True False
| Or (Short Circuit) False | true True

The following is a simple explanation of some problems:

1. "^" refers to the logic of the calculated operand "exclusive or". That is to say, the result is true only when only one operand is true.

2. the difference between "&" and "&" is that if the former is used for join, expressions on both sides of "&" are involved in calculation under any circumstances. If the latter connection is used, if the left side of "&" is false, the expression on the right side is not calculated.

3. the difference between "|" and "|" is that "|" indicates that any Boolean expression on both sides is true, and true is returned for the combination. For "| ", similar to the second. If the left side is true, true is returned. If the left side is falsh, the right side is displayed. If the right side is true, true is returned. Otherwise, falsh is returned.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.