3.11 Swift字典的操作 遍历

前端之家收集整理的这篇文章主要介绍了3.11 Swift字典的操作 遍历前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

let dic = ["apple" : "苹果","bag" : ""]

for (key,value) in dic

{

print("键值对==\(key) : \(value)")

}

print("------------->")

print(dic.keys)

print("------------->")

print(dic.values)

for key in dic.keys

{

print("key==\(key)")

}

for value in dic.values

{

print("value==\(value)")

}

原文链接:https://www.f2er.com/swift/322486.html

猜你在找的Swift相关文章