objective-c 强大的布尔类型

objective-c codes:

#import <Foundation/Foundation.h>
BOOL areIntsDifferent(int thing1,int thing2)
{
    if (thing1==thing2) {
        return (NO);
    }else{
        return (YES);
    }
}

NSString *boolString(BOOL yesNo)
{
    if (yesNo==NO) {
        return (@"No");
    }else{
        return (@"Yes");
    }
}

int main(int argc,const char *argv[])
{
    BOOL areTheyDifferent;
    areTheyDifferent=areIntsDifferent(5, 5);
    NSLog(@"are %d and %d different? %@",5,5,boolString(areTheyDifferent));
    areTheyDifferent=areIntsDifferent(23, 42);
    return (0);
}

console:

  2013-09-13 15:06:29.452 BOOL Party[1821:303] are 5 and 5 different? No