Swift - 10 - assert(断言)

//: Playground - noun: a place where people can play

import UIKit

var str = "Hello, playground"


// 断言, 必须符合某个条件,程序才能继续运行下去
// 可以看做是一个底线要求

var age = 19;

assert(age > 18, "年龄必须大于18岁才能继续");

  

posted @ 2015-12-16 11:35  Rinpe  阅读(169)  评论(0编辑  收藏  举报