Boolean type of C #

Source: Internet
Author: User
Tags expression

Boolean types are used to denote the concepts of "true" and "false". Although this may seem simple, the application is very extensive. As we all know, the computer is actually using binary to represent all kinds of data, that is, no matter what data, in the computer is a binary way of processing and storage. Boolean types represent only two values for logical variables: TRUE and false. In C #, each is represented by a value of true and false two.

Note: in C and C + +, 0来 means "false", and any other non-0 expression means "true". This informal expression has been discarded in C #. In C #, a true value cannot be replaced by any other value other than 0. It is illegal to convert an integer type to a Boolean type without any further conversions between the other integer types and the Boolean types:

BOOL X=1//error, no such notation exists. Can only be written as X=true or X=false.

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.