摘要: Switch的一个例子: let vegetable = "red pepper" switch vegetable { case "celery": let vegetableComment = "Add some raisins and make ants on a log." case "cucumber", "watercress": let vegetableComme... 阅读全文
posted @ 2015-01-29 11:48 极地渔翁.NTLD 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 最近在博客园做一些学习笔记。一个是看apple的swift官方书,另外一个是随学校课堂(SICP)学习scheme。 这两种语言都谈不上普及(或者说swift太新)。博客园原来的windows live writer代码高亮插件并不适用于这些语言。 于是我只好自己想办法。首先我找到了highlight.js这个js高亮插件。搜索到其官网。按照步骤部署在博客园即可。 需要注意的是,博客园我目前... 阅读全文
posted @ 2015-01-27 08:06 极地渔翁.NTLD 阅读(382) 评论(0) 推荐(1) 编辑
摘要: 关于Optional的Control Flow if let constantName = someOptional { statements } 如果该Optional为nil,则不进入if,否则执行且constantName为该Optional的值 例子: if let actualNumber = possibleNumber.toInt() { printl... 阅读全文
posted @ 2015-01-22 12:34 极地渔翁.NTLD 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Type Aliasestypealias AudioSample = UInt16Booleans非boolean值不会被替代为bool,例如:let i = 1if i { // this example will not compile, and will report an error}T... 阅读全文
posted @ 2015-01-14 04:17 极地渔翁.NTLD 阅读(223) 评论(0) 推荐(0) 编辑
摘要: (define pi 3.14159)(define radius 10)(* pi (* radius radius))(define circumference (* 2 pi radius))circumference(define pi 100000)picircumference(defi... 阅读全文
posted @ 2015-01-13 22:37 极地渔翁.NTLD 阅读(199) 评论(0) 推荐(0) 编辑
摘要: let Constant var Variable let implicitInteger = 70 let implicitDouble = 70.0 let explicitDouble: Double = 70 The so-called type implications To include value in strings:let fruitSummary = "I have... 阅读全文
posted @ 2015-01-03 21:55 极地渔翁.NTLD 阅读(225) 评论(0) 推荐(0) 编辑
摘要: func &( left:OCBool, right: OCBool)->OCBool{ if left{ return right } else{ return false } } 阅读全文
posted @ 2015-01-03 17:25 极地渔翁.NTLD 阅读(358) 评论(1) 推荐(0) 编辑