Traversing the dictionary
var emojiMeaning = [
"ð¤": "Thinking Face",
"ðª": "Sleepy Face",
"ðµ": "Dizzy Face"
]
// loop through keys and values
for (emoji, meaning) in emojiMeaning {
print("\(emoji) is called '\(meaning)Emoji'")
}
// iterate through keys only
for emoji in emojiMeaning. keys {
print(emoji)
}
// iterate through values only
for meaning in emojiMeaning. values {
print(meaning)
}
Comments