imzyf / ios-swift-learning-notes

📝 iOS Swift Learning Notes - see Issues
MIT License
0 stars 0 forks source link

for 循环遍历 #46

Closed imzyf closed 6 years ago

imzyf commented 6 years ago

http://blog.csdn.net/dylan_lwb_/article/details/40299371

遍历字典

var ageDict:Dictionary<String, Int> = ["mary": 19, "rose": 20]  

var names = [String]()  
var ages = [Int]()  
for (key, value) in ageDict {  
    names.append(key)  
    ages.append(value)  
}  
names  
ages
imzyf commented 6 years ago

so easy