localhost:~ hejiasheng$ xcrun swift
Welcome to Swift! Type :help for assistance.
1> var a:Int
a: Int = 0
2> let b:Int
<REPL>:2:5: error: ‘let‘ declarations require an initializer expression
let b:Int
^
2> let b = 5
b: Int = 5
3> b = 6
4> println(6)
6
5> println(b)
6
很多地方说 let 变量不能改变,我测试发现可以改变。
但定义时候需要 初始化。

playground 情况下,会报错。 能负值。
ios8 swift开发:let var 区别讨论,布布扣,bubuko.com
原文:http://blog.csdn.net/woshiwupo/article/details/36184329