天天看點

swift學習之路(十)字典

import Foundation

var sample : Dictionary<String,Int> = ["key1":1,"key2":2,"key3":3]

sample.updateValue(22, forKey: "key2")

print(sample["key2"])

sample.removeValueForKey("key2")

for values in sample.values{

print(values)

}