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

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]
主站蜘蛛池模板: 娄烦县| 方山县| 石首市| 柳江县| 尚志市| 彭水| 玛曲县| 开江县| 新密市| 育儿| 江安县| 仪陇县| 泸定县| 鹿泉市| 轮台县| 泰州市| 定远县| 平果县| 玉门市| 阿克| 延吉市| 都匀市| 合水县| 织金县| 禄丰县| 白朗县| 波密县| 青河县| 泸西县| 修文县| 名山县| 莲花县| 瑞金市| 东台市| 嘉黎县| 陇川县| 宜章县| 武义县| 河西区| 信宜市| 青浦区|