I am new to Objective-C and i wonder why this method compiles, can anyone explain me why?
Thank you
-(BOOL) isEnabled{
return 56;
}
I am new to Objective-C and i wonder why this method compiles, can anyone explain me why?
Thank you
-(BOOL) isEnabled{
return 56;
}
A BOOL
in Objective-C is a typedef
of signed char
. Since 56
fits in that type, the implicit conversion from a literal int
results in no data loss.
You can think of a BOOL in objective-c as
false === 0 === nil //Anything that is zero or nil is false
true = !false //Anything that is NOT zero or nil is true.
56 therefore returns true because it is not zero