objective c - What is the difference between @YES/@NO and YES/NO? -


in objective-c difference between @yes/@no , yes/no? types used each?

@yes short form of [nsnumber numberwithbool:yes]

&

@no short form of [nsnumber numberwithbool:no]

and if write

if(@no)    statement; 

the above if statement execute since above statement

if([nsnumber numberwithbool:no] != nil) 

and it's not equal nil true , pass.

whereas yes , no bool's , defined as-

#define yes             (bool)1  #define no              (bool)0 

yes & no same true & false, 1 & 0 respectively , can use 1 & 0 instead of yes & no, far readability concerned yes & no will(should) preferred.


Comments