Iterating Through a Dictionary in Swift

后端 未结 7 702
醉话见心
醉话见心 2020-11-27 12:12

I am a little confused on the answer that Xcode is giving me to this experiment in the Swift Programming Language Guide:

// Use a for-in to iterate through a         


        
7条回答
  •  情歌与酒
    2020-11-27 12:40

    Arrays are ordered collections but dictionaries and sets are unordered collections. Thus you can't predict the order of iteration in a dictionary or a set.

    Read this article to know more about Collection Types: Swift Programming Language

提交回复
热议问题