[swift-evolution] Nested for-in loops syntax

Maxim Bogdanov bm at masax.ru
Sun Jul 17 05:05:51 CDT 2016

Hello, community.

As I understood from documentation the only way to iterate multidimensional
array or a dictionary (with for loop) is this:

let multidimensionalDictionary = ["a":["b": "c"], "b":["c": "d"], "c":
["d": "e"]]
for (key, value) in multidimensionalDictionary {
    for (nestedKey, nestedValue) in value {
        print("\(key) -> \(nestedKey) -> \(nestedValue)")

What do you think about this syntax?
for (key, nestedKey, nestedValue) in multidimensionalDictionary {
    print("\(key) -> \(nestedKey) -> \(nestedValue)")

I'm new to mailing list feature. If I do something wrong please let me know
about it.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160717/a0bd83d4/attachment.html>

More information about the swift-evolution mailing list