Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between YES/TRUE? [duplicate]

Possible Duplicate:
Is there a difference between YES/NO,TRUE/FALSE and true/false in objective-c?

I have one question, and it can be answered quickly. I have this code:

.h

UITableView *table;

.m
table.hidden = YES;
table.hidden = TRUE;

Is there any difference between the last two lines of code ? Or is EXACTLY the same YES and TRUE?

like image 816
Adri Avatar asked Feb 06 '12 19:02

Adri


2 Answers

The TRUE macro is only provided as backwards-compatibility with C code (Objective-C is designed to be a strict super-set of C). They both mean the same thing.

like image 154
Chris Browne Avatar answered Oct 23 '22 13:10

Chris Browne


The original success value for BOOL in Objective C is the YES. TRUE is just a mimic of it for compatibility. You can use both but I highly recommend you to use what was originally designed for the language. This is important in case future updates of the language changed anything in the syntax of the language (which is not likely to happen in this case), using the original syntax will not cause you to fix anything in your old code.

like image 31
antf Avatar answered Oct 23 '22 11:10

antf