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

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]
主站蜘蛛池模板: 毕节市| 和林格尔县| 蕉岭县| 垦利县| 绍兴县| 长顺县| 施秉县| 酉阳| 雷山县| 宣汉县| 中方县| 阿坝| 无锡市| 奇台县| 河北省| 隆昌县| 肇源县| 温泉县| 济源市| 高清| 东莞市| 张家口市| 烟台市| 荔波县| 巩留县| 土默特右旗| 于都县| 新乐市| 华宁县| 肇州县| 平安县| 日喀则市| 平塘县| 乾安县| 米易县| 峨眉山市| 木兰县| 大关县| 孝义市| 安庆市| 防城港市|