官术网_书友最值得收藏!

The stride functions

stride functions enable us to iterate through ranges with a step other than one. There are two stride functions: the stride to function, which iterates over exclusive ranges, and stride through, which iterates over inclusive ranges. Consider the following example:

let fourToTwo = Array(stride(from: 4, to: 1, by: -1)) // [4, 3, 2] 
let fourToOne = Array(stride(from:4, through: 1, by: -1)) // [4, 3, 2, 1]
主站蜘蛛池模板: 永新县| 寻乌县| 邯郸市| 乐陵市| 灵丘县| 治多县| 资源县| 佳木斯市| 浑源县| 进贤县| 塔城市| 方山县| 华蓥市| 秭归县| 克拉玛依市| 南开区| 南充市| 同仁县| 六安市| 宜宾市| 弥勒县| 苏州市| 汕头市| 屏山县| 禄丰县| 华池县| 平安县| 博客| 娱乐| 清新县| 广汉市| 冷水江市| 马尔康县| 岳阳县| 诸暨市| 磐安县| 宁夏| 正宁县| 永兴县| 通许县| 嵊州市|