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

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.

主站蜘蛛池模板: 江陵县| 花莲县| 丰镇市| 永胜县| 南平市| 宜兰县| 阿图什市| 永定县| 郁南县| 定日县| 云梦县| 晋州市| 苏尼特左旗| 平遥县| 吉木萨尔县| 金沙县| 镶黄旗| 武城县| 浦县| 武陟县| 平遥县| 洛阳市| 襄城县| 德州市| 晋中市| 工布江达县| 民乐县| 吉木乃县| 泸州市| 内乡县| 奉化市| 林州市| 濉溪县| 昂仁县| 北碚区| 盐山县| 晋城| 五华县| 论坛| 仪陇县| 信宜市|