2011年11月5日 星期六

BOOL in Objective C

not bool , but BOOL
not true or false ,but YES or NO

布林值在Objective C 中的宣告是全大寫的BOOL
不是bool
而且其使用的不是true or false
而是 YES or NO
如下
BOOL isDifferent = YES ;

if (isDifferent)
{
NSLog(@"The isDifferent  is true and the char is %i",isDifferent);
} else
{
NSLog(@"The isDifferent  is false and the char is %i",isDifferent);
}
// YES==1 , NO==2

沒有留言: