- iOS 12 Programming for Beginners
- Craig Clayton
- 201字
- 2021-07-02 15:04:52
Creating a Boolean
Now, it is time to create a Bool. Let's make it a constant. Enter the following code:
let isConstant:Bool = true
This is demonstrated in the following screenshot:

Since isConstant is set, let's make it false by adding this:
isConstant = false
On the same line as what you just entered, you will now see a red circle with a white dot in the middle. The red circle means that there is an error. The white circle inside of it indicates that Xcode can fix the error for you (most of the time):

You will also notice an error in your Debug Panel, which is just a more detailed version of the error. This error is telling us that we are trying to change the value of a constant when we cannot do so.
If you tap on the circle, you will see that Playgrounds suggests that you change the let to a var since you cannot assign a value to a constant:

Since we want it to remain a constant, let's delete the line isConstant = false. We have covered basic data types, but there are some other programming basics we should discuss as well.
- CorelDRAW X6 中文版圖形設計實戰從入門到精通
- 網絡協議工程
- MERN Quick Start Guide
- 物聯網識別技術
- 萬物互聯:蜂窩物聯網組網技術詳解
- 信息通信網絡建設安全管理概要2
- 2018網信發展報告
- 物聯網與無線傳感器網絡
- Learning Swift(Second Edition)
- OMNeT++與網絡仿真
- The Kubernetes Workshop
- jQuery Mobile Web Development Essentials
- 5G時代的大數據技術架構和關鍵技術詳解
- Hands-On Docker for Microservices with Python
- Guide to NoSQL with Azure Cosmos DB