//定义一个变量
var str = “Hello, playground”
//定义一个变量,并且设置静态属性为字符串类型
var hello : String = “Hello world”
//定义一个数组
var a = (“ss”,”ss”)
//字符串拼接方法
hello += “haha”
//定义一个int类型变量
var b = 2
var sb = “sb”
//控制台打印变量值
print(hello)
//输出(拼接一个字符串)
print(“hello (sd)”)
//可以使用表情
print(“(sd) = ��”)
var �� = “小胖子”
print(“(��)爱(sb)”)
//定义基本类型
var aa : Int = 32
var bb : Float = 12.0
var cc = Float(aa) + bb
let dd = 123
// 元组
//var httpError : (Int, String) = (404 , “error”)
var httpError = (404, “error”)
httpError.0
print(“(httpError.0)是(httpError.1)”)
var httpError1 = (errorNum : 404, errorStr : “error”)
httpError1.errorNum
print(“(httpError1.errorNum)是(httpError1.errorStr)”)
var ���� = [“猪”,”狗”]
print(“(����[0])”)
var zz = “zz”
//向数组里插入一个元素
����.insert(“呵呵”, atIndex: 0)
for name in ����{
print(name)
}
for (index , name) in EnumerateSequence(����){
print(“(index)和(name)”)
}
var person : Dictionary