- iOS 12 Programming for Beginners
- Craig Clayton
- 109字
- 2021-07-02 15:04:57
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.
推薦閱讀
- 通信網(wǎng)絡(luò)基礎(chǔ)與設(shè)備
- 社交網(wǎng)絡(luò)對齊
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- Proxmox High Availability
- SD-WAN架構(gòu)與技術(shù)(第2版)
- 大話社交網(wǎng)絡(luò)
- 企業(yè)網(wǎng)絡(luò)安全管理
- 智慧光網(wǎng)絡(luò):關(guān)鍵技術(shù)、應(yīng)用實踐和未來演進(jìn)
- IPv6網(wǎng)絡(luò)切片:使能千行百業(yè)新體驗
- 通信十年:擁抱互聯(lián)網(wǎng)
- 物聯(lián)網(wǎng)頂層設(shè)計與關(guān)鍵技術(shù)
- Twilio Cookbook(Second Edition)
- 云計算、網(wǎng)絡(luò)安全和網(wǎng)絡(luò)盜竊:網(wǎng)絡(luò)世界防盜初學(xué)指南
- OpenShift Cookbook
- OpenCV 3 Computer Vision with Python Cookbook