0
Meaning of optionals?
What is meant by "wrapping" and "unwrapping" in the context of describing how optionals work? Does it imply some kind of surrounding a variable or value with something?!
4 Réponses
+ 1
Swift, for safety reasons, requires all variables and constants to always hold a value. This prevents that scenario where the value of a variable can be unknown. To solve this problem, Swift created the typeOptional that can either hold no value (None) or hold some value (Some).
0
Thanks for your reply but it still doesn't explain why the term "wrapping" is used?
0
When you wrap a variable means that you dont have to know what is inside the variable. Manage the variable as it holds either none or some value.
- 1
menage?