Alex Rivera | Logout

Why does Objective-C use YES/NO macro convention instead of true/false?

Asked 2011-06-21T06:01:15.130
18

Most languages use the true/false keywords for boolean values. I found that even Smalltalk is using true/false. I know Objective-C is just borrowing concepts from Smalltalk, not the language itself, but I'm curious why it's using YES/NO instead of the more widely-used true/false. Is there any historical reason?

Edit
Report

1 Answer

2

It is strange, but I find code is more readable using the YES/NO macros rather than TRUE/FALSE (which also work).

However, Objective-C is a superset of C99 now, so you should be using the C99 boolean type and true and false wherever possible. I was toying with the idea of defining yes and no to true and false but have resisted it so far.

answered 2011-06-21T08:09:55.020

Your Answer