Objective-C formatting string for boolean?

Moshe picture Moshe · Apr 9, 2010 · Viewed 91.9k times · Source

What formatter is used for boolean values?

EDIT:

Example: NSLog(@" ??", BOOL_VAL);, what is ?? ?

Answer

Michael Myers picture Michael Myers · Apr 9, 2010

One way to do it is to convert to strings (since there are only two possibilities, it isn't hard):

NSLog(@" %s", BOOL_VAL ? "true" : "false");

I don't think there is a format specifier for boolean values.