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

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.

主站蜘蛛池模板: 商洛市| 余干县| 昆明市| 邢台县| 泸水县| 崇左市| 漳州市| 陵水| 通山县| 阿克| 武鸣县| 绥中县| 巨野县| 汽车| 漳平市| 临洮县| 蕉岭县| 常德市| 甘泉县| 准格尔旗| 梁山县| 西安市| 讷河市| 卢氏县| 高州市| 丰都县| 黎平县| 天镇县| 霍邱县| 射阳县| 平湖市| 龙泉市| 息烽县| 商河县| 乌拉特前旗| 马鞍山市| 启东市| 鞍山市| 哈巴河县| 普定县| 进贤县|