python 布尔型的定义
Definition:
定义:
Bool is a fundamental type in C, C++ and C# languages.
Bool是C,C ++和C#语言的基本类型。
Variables of this type can only take two values- 1 and 0. In C++ these correspond to true and false and can be used interchangably. In C# bool variables can only use true and false, they are not interchangeable with 1 and 0.
这种类型的变量只能采用两个值-1和0。在C ++中,它们对应于true和false,可以互换使用。 在C#中,布尔变量只能使用true和false,它们不能与1和0互换。
Boolean variables can be packed together to save memory space. An understanding of binary can be a useful skill.
布尔变量可以打包在一起以节省内存空间。 理解二进制可能是有用的技能。
Note Because of the way false and 0 are usually treated the same (except in C#), any non zero value is the same as true, not just 1.
注意由于通常将false和0视为相同(在C#中除外),因此任何非零值都与true相同,而不仅仅是1。
( )
Also Known As: Boolean
也称为:布尔值
Examples: Using a bool and checking for true/false improves readability of your program
示例:使用布尔值并检查对/错是否可以提高程序的可读性
python 布尔型的定义