I was wondering what the difference was between the following values in objective c:
TRUE(uppercase) - true(lowercase) - yes
FALSE(uppercase) - false(lowercase) - no
they are colored differently in the IDE, are there different situations when you would use the different boolean values?
Thanks
These values are colored differently, as they are used in two different types –
BOOLandbooland are different language constructs.BOOLis a macro re-definition ofsigned char, which means it can have more than two values, and while the mapping isNO/FALSE== 0,YES/TRUE== 1, you have to be careful when writing boolean expressions and treat any non-zero value as true. Values that can be assigned toBOOLare defined as macros and are colored accordingly.Meanwhile,
boolon the other hand is a true boolean type and can have only two values –trueandfalse. Its values are native language constructs and are colored as such.Here are some other SO discussions of this topic:
Is there a difference between YES/NO,TRUE/FALSE and true/false in objective-c?
Objective-C : BOOL vs bool