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

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]
主站蜘蛛池模板: 徐闻县| 乌苏市| 九寨沟县| 金溪县| 吕梁市| 垣曲县| 武义县| 郴州市| 嘉善县| 伊宁县| 新野县| 长宁区| 田阳县| 铁岭县| 武义县| 兰州市| 文化| 东乡县| 高安市| 措美县| 奇台县| 张家口市| 茌平县| 祁连县| 浮山县| 松原市| 青阳县| 石阡县| 防城港市| 英吉沙县| 石景山区| 喀喇沁旗| 特克斯县| 中江县| 永修县| 邻水| 武宁县| 奉化市| 宁陵县| 浮梁县| 潢川县|