说明:布尔型变量表示真假结果的类型,只有2个值真(true 或者 1) ,假(false 或者 0) 数据类型内存空间数据范围bool(布尔类型)1个字节true或者1,false或者0 void OnStart() { // bool: 布尔类型 bool b1 = true; // Print("b1的值=" + (string) b1); bool b2 = 1; // Print("b2的值=" + (string) b2); //如果布尔的值为假 bool b3 = false; // Print("b3的值=" + (string) b3); bool b4 = 0; // Print("b4的值=" + (string) b4); // 关于bool类型的其他问题 bool b5 = 10; // Print("b5=" + (string) b5); bool b6 = -0; Print("b6=" + (string) b6); }C++复制 学习传送门: https://www.bilibili.com/video/BV1iP41177T3/