首页 > 其他 > 详细

布尔类型-2.0

时间:2014-09-25 23:31:29      阅读:608      评论:0      收藏:0      [点我收藏+]
//
//  ViewController.m
//  OC-Design
//
//  Created by 葛迅 on 14/9/25.
//
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    BOOL areTheyDiff;
    areTheyDiff = areIntsDifferent(5, 5);
    NSLog(@"are %d and %d diff?%@",5,5,boolString(areTheyDiff));
    
    areTheyDiff= areIntsDifferent(25, 35);
    NSLog(@"are %d and %d diff?%@",25,35,boolString(areTheyDiff));
    
}

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";
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

布尔类型-2.0

原文:http://my.oschina.net/gexun/blog/318707

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!