- 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.
- 多媒體CAI課件設計與制作導論(第二版)
- C語言程序設計案例教程(第2版)
- 編程卓越之道(卷3):軟件工程化
- Mastering Articulate Storyline
- 算法訓練營:提高篇(全彩版)
- Highcharts Cookbook
- RabbitMQ Cookbook
- Julia高性能科學計算(第2版)
- HTML5從入門到精通(第4版)
- Mastering openFrameworks:Creative Coding Demystified
- Getting Started with Python
- 深入實踐DDD:以DSL驅動復雜軟件開發
- Python 3 Object:oriented Programming(Second Edition)
- 關系數據庫與SQL Server 2012(第3版)
- Building Scalable Apps with Redis and Node.js