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

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.

主站蜘蛛池模板: 喀喇沁旗| 金塔县| 姜堰市| 岐山县| 康乐县| 临沧市| 西华县| 枣强县| 毕节市| 潮安县| 柳林县| 五台县| 洮南市| 县级市| 惠东县| 涞水县| 鄄城县| 宿松县| 凤翔县| 丹东市| 德保县| 寿阳县| 昌邑市| 会泽县| 泽普县| 白城市| 郎溪县| 岱山县| 什邡市| 深州市| 德清县| 韶关市| 扬州市| 正阳县| 常宁市| 会同县| 台前县| 寿光市| 文安县| 祁连县| 房山区|