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

Half-closed range

Let's make another constant that is known as a half-closed range and set it equal to 10 < 20. Add the following to Playgrounds:

let halfClosedRange = 10..<20

Your code should now look like this:

A half-closed range is the same as a closed range, except that the end value is not included. In this example, this means that 10 through 19 are included, and 20 will be excluded.

At this point, you will notice that your Results Panel shows you CountableClosedRange(10...20) and CountableRange(10..<20). We cannot see all of the numbers within the range. To see all of the numbers, we need to use a loop.

主站蜘蛛池模板: 西华县| 铜梁县| 铜山县| 五家渠市| 车险| 南木林县| 盐源县| 九江县| 闵行区| 乡宁县| 韩城市| 郯城县| 肇东市| 澎湖县| 扎囊县| 来凤县| 旅游| 阳东县| 梅河口市| 永年县| 宜兰市| 南澳县| 丰台区| 新民市| 砚山县| 澎湖县| 正宁县| 平陆县| 寻甸| 昌平区| 东辽县| 垦利县| 苍溪县| 阿拉善盟| 清河县| 武陟县| 舞钢市| 和平县| 闽清县| 运城市| 金沙县|