Swift小课

100 Days of Swift - Day 02 集合类型

2022-12-08  本文已影响0人  NieFeng1024

Day 02 集合类型

2.1 Arrays(数组)

2.2 Set

2.3 Tuples

2.4 Arrays vs sets vs tuples

2.5 Dictionaries

2.6 Dictionary default values

2.7 Creating empty collections

        // 空字典
        var teams = [String: String]()
        // 更新字典
        teams["Paul"] = "Red"
        // 空 Int 数组
        var results = [Int]()
        // 空 字符串Set
        var words = Set<String>()
        // 空 Int Set
        var numbers = Set<Int>()
        // 空 字典
        var scores = Dictionary<String, Int>()
        // 空 数组
        var results = Array<Int>()

2.8 Enumerations

2.9 Eunm associate

声明:本文创作来自hackingwithswift

上一篇 下一篇

猜你喜欢

热点阅读