Swift Section Two(数组与字典) 2014-09-15 swift swift 数组与字典 12345678910111213141516171819202122232425262728293031323334// Playground - noun: a place where people can playimport UIKit//swift 第二课 数组与字典//1.数组的声明var shoppingList = ["catfish","water","tulips","blue paint"]shoppingList[1] = "bottle of water"print(shoppingList)//2.字典的声明var occupations = ["Malcolm":"Captain","Kaylee":"Mechanic"]occupations["Jayne"] = "Public Relations"print(occupations)//3.空数组和空字典的声明let emptyArray = [String]()let emptyDictionary = [String : Float]()//甚至你可以这样清空数组shoppingList = []occupations = [:] 源代码请前往我的github Newer Swift Section Three(分支和循环) Older Swift Section One(变量和常量)