iOS中boolean、Boolean、BOOL、bool的区别测试
- bool t1 =1;//true or false
- BOOL t2 = 3;//YES or NO
- Boolean t3 =1; //unsigned char type
- boolean_t t4 = 1;//int type
- NSAssert(t1,@"bool t1 is NO");//经过测试
- NSAssert(t2,@"BOOL t2 is NO");//经过测试
- NSAssert(t3,@"Boolean t3 is NO");//经过测试
- NSAssert(t4,@"boolean_t t4 is NO");//经过测试
bool 是int型,bool b 当b!=0 有 b=true.net
BOOL 是unsigned char型,BOOL b 当b=1 有 b=YESblog
Boolean 是char型get
boolean_t 是int型class
注意:上述类型做为判断条件时只要变量值不为零,则条件成立。变量