Associative array/Iteration: Difference between revisions
Content added Content deleted
Jazzedpineda (talk | contribs) (Add EasyLang) |
|||
Line 4,206: | Line 4,206: | ||
// iterating over key-value pairs: |
// iterating over key-value pairs: |
||
for (key, value) in myMap { |
for (key, value) in myMap { |
||
print("key = \(key), value = \(value)") |
|||
} |
|||
// Just the keys |
|||
for key in myMap.keys |
|||
{ |
|||
print("key = \(key)") |
|||
} |
|||
// Just the values |
|||
for value in myMap.values |
|||
{ |
|||
print("value = \(value)") |
|||
}</syntaxhighlight> |
}</syntaxhighlight> |
||