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 */
时间: 2024-10-13 02:57:52