- Swift 4 Programming Cookbook
- Keith Moon
- 223字
- 2021-07-08 10:21:22
Optionals, unwrap, and force unwrap
In the real world, we don't always know the answer to a problem, and problems can occur if we blindly assume that someone does. The same is true in programming languages, especially when dealing with external systems that we may not control. In many languages, including Objective-C (until recently), there was no way to indicate that something being declared may not exist at the time you attempt to access it. This would lead to either fragile code that could have broken if a nil unexpectedly found its way in or tests being run all over the code to ensure that a value did exist where it was needed, which added complexity and increased the boilerplate code that had to be written.
With a focus on Swift being type-safe and making it easier to write safe code, this ambiguity had to be addressed, and the Swift language does this with the use of optionals.
- Learning Neo4j
- Visual Studio 2012 Cookbook
- Visual Basic編程:從基礎(chǔ)到實(shí)踐(第2版)
- JIRA 7 Administration Cookbook(Second Edition)
- PyTorch自然語(yǔ)言處理入門(mén)與實(shí)戰(zhàn)
- Unity Virtual Reality Projects
- INSTANT Weka How-to
- 匯編語(yǔ)言程序設(shè)計(jì)(第2版)
- PHP從入門(mén)到精通(第4版)(軟件開(kāi)發(fā)視頻大講堂)
- 51單片機(jī)C語(yǔ)言開(kāi)發(fā)教程
- Instant Apache Camel Messaging System
- MongoDB Cookbook(Second Edition)
- Google Adsense優(yōu)化實(shí)戰(zhàn)
- 川哥教你Spring Boot 2實(shí)戰(zhàn)
- 機(jī)器人ROS開(kāi)發(fā)實(shí)踐