swift学习记录(switch)
来源:互联网 发布:怎么让淘宝店铺商品排名靠前 编辑:程序博客网 时间:2024/04/30 01:34
switch 语法本身没有什么,让我感兴趣当有一点,就是swift的switch语法支持类似sql的用法,来看一下它书中的举例:
import Cocoa
在case3中,类似sql的语法非常稀奇,如果能支持正则表达式那肯定是极好的。不需要在每个子句中加break也是极好的,就不知道它支不支持索引了,暂时留着这个问题,欢迎高手解答。let vegetable ="red pepper"
switch vegetable {
case "celery":
let vegetableComment ="Add some raisins and make ants on a log."
case "cucumber","watercress":
let vegetableComment ="That would make a good tea sandwich."
case let x where x.hasSuffix("pepper"):
let vegetableComment ="Is it a spicy\(x)?"
default :
let vegetableComment ="Everything tastes good in soup."
}
0 0
- swift学习记录(switch)
- Swift学习记录 -- 4.逻辑分支(switch)
- swift学习记录(开端)
- swift学习记录(Optional)
- swift学习记录(for)
- swift学习记录(func)
- 操作 swift学习记录(-)
- swift学习记录(selector)
- swift学习记录(in)
- swift 学习记录(一)
- swift 学习记录(二)
- swift 学习记录(三)
- swift 学习记录(四)
- swift学习记录(String)
- swift学习记录(函数)
- swift学习记录(枚举)
- swift 学习记录(继承)
- swift学习记录(析构器)
- 喷水装置(一)
- 如何给PowerPoint每页加上总页码
- springMVC上传文件优化(12)
- javascript中的null,undefined和‘’(或者“”,表示空字符串)
- 2015年春节往事小记
- swift学习记录(switch)
- 如何判断你的初创企业是否有募资潜力
- The Network Adapter could not establish the connection
- 从今天开始
- JSP状态管理 http协议的无状态性 Cookie简介
- Foundation框架
- 【原创】用Matlab制作图像块颜色提取工具(一)
- 文章标题
- MVC体系结构 和代理协议消息传递机制