- iOS 12 Programming for Beginners
- Craig Clayton
- 118字
- 2021-07-02 15:04:52
Why constants versus variables?
You might be asking yourself "Why would you ever want to make something constant?". Since constants cannot change after you run your app, they keep you from accidentally breaking a value that should not change. Another excellent use for constants is for base URLs, as you would not want these to change. When you are getting data, you do not want to change the value midway through your app accidentally. Apple recommends that you use let whenever possible. Typically, I use let until Xcode warns me that a var is preferable. If I change the value from let to var, then I am verifying that this is the behavior I want.
推薦閱讀
- 物聯網智慧安監技術
- Building Django 2.0 Web Applications
- Truffle Quick Start Guide
- Building RESTful Web Services with Spring 5(Second Edition)
- 2018網信發展報告
- 中國互聯網發展報告2018
- Bonita Open Solution 5.x Essentials
- 端到端QoS網絡設計
- 網管第一課:網絡操作系統與配置管理
- 精通SEO:100%網站流量提升密碼
- 物聯網
- 信息技術安全評估準則:源流、方法與實踐
- 現場綜合化網絡運營與維護:運營商數字化轉型技術與實踐
- 路由與交換技術
- Hands-On Full Stack Web Development with Aurelia