Swift 数组、字典
1 import Foundation 2 3 // 数组 4 var arr = ["Hello","jinapangpang",100,2.3] 5 var arr1 = [] 6 print(arr) 7 8 // 字典 9 var dict = ["name":"jinpangpang","age":"16"] 10 // 添加新项 11 dict["sex"]="Female" 12 print(dict) 13 print(dict["name"]) 14 15 /* 输出结果如下 16 [Hello, jinapangpang, 100, 2.3] 17 ["age": "16", "sex": "Female", "name": "jinpangpang"] 18 Optional("jinpangpang") 19 Hello, World! 20 */