Boolean type of value type:
Boolean types are used to denote the two concepts of ' true ' and ' false ', although they may seem simple, but they are very widely used. We know that computers use binary to represent a variety of data, with only 0 or 1 inside it. The Boolean type represents a logical variable of only 2, True or False.
In this case, we contrast the C + +, the meaning of Boolean type C/C + +, which means "true" or "false" values, 0 means ' false ' other than 0 of the number means ' true ' this irregular expression is discarded in C #. True, False in C # cannot be substituted with other values, there is no conversion between an integer type and a Boolean type, which means that converting an integer type to a Boolean type is illegal.
BOOL X=1//Error
BOOL X=true or x = false//correct
Next, define a Boolean variable and output:
Using System; Using System.Collections.Generic; Using System.Linq; Using System.Text; Namespace Example { class program { static void Main (string[] args) { bool b=true; Console.WriteLine (b);}}
The result is:
True
The above is the C # Learning Diary---Data type of the Boolean type of content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!