#define LogBool(BOOLVARIABLE) NSLog(@"%s: %@",#BOOLVARIABLE, BOOLVARIABLE ? @"YES" : @"NO" )
BOOL success = NO;
LogBool(success); // Prints out 'success: NO' to the console
success = YES;
LogBool(success); // Prints out 'success: YES' to the console
BOOL flagWayOne = TRUE;
NSLog(@"The flagWayOne result is - %@",flagWayOne ? @"TRUE":@"FALSE");
第二种方法是
BOOL flagWayTwo = YES;
NSLog(@"The flagWayTwo result is - %@",flagWayTwo ? @"YES":@"NO");
第三种方法是
BOOL flagWayThree = 1;
NSLog(@"The flagWayThree result is - %d",flagWayThree ? 1:0);
第四种方法是
BOOL flagWayFour = FALSE; // You can set YES or NO here.Because TRUE = YES,FALSE = NO and also 1 is equal to YES,TRUE and 0 is equal to FALSE,NO whatever you want set here.
NSLog(@"The flagWayFour result is - %s",flagWayFour ? YES:NO);