summaryrefslogtreecommitdiffhomepage
path: root/swift.html.markdown
diff options
context:
space:
mode:
authorClayton Walker <claytonwalkerucf@knights.ucf.edu>2015-10-08 23:27:19 -0400
committerClayton Walker <claytonwalkerucf@knights.ucf.edu>2015-10-08 23:27:19 -0400
commitb4860de42f2bbf0ab97ef28085eb40accb030657 (patch)
tree3e79c64479ad4b936a7ed0f577098a0d7e3a5fd5 /swift.html.markdown
parentad16a31c0751f244a46cadbfb3540943af73349d (diff)
Suggested changes
Diffstat (limited to 'swift.html.markdown')
-rw-r--r--swift.html.markdown10
1 files changed, 5 insertions, 5 deletions
diff --git a/swift.html.markdown b/swift.html.markdown
index 46e5e6d4..9f0019d8 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -58,8 +58,8 @@ let piText = "Pi = \(π), Pi 2 = \(π * 2)" // String interpolation
print("Build value: \(buildValue)") // Build value: 7
/*
- Optionals are a Swift language feature that either contains a value,
- or contains nil (no value) to indicate that a value is missing.
+ Optionals are a Swift language feature that either contains a value,
+ or contains nil (no value) to indicate that a value is missing.
A question mark (?) after the type marks the value as optional.
Because Swift requires every property to have a value, even nil must be
@@ -82,9 +82,9 @@ if someOptionalString != nil {
someOptionalString = nil
/*
- To get the underlying type from an optional, you unwrap it using the
- force unwrap operator (!). Only use the unwrap operator if you're sure
- the underlying value isn't nil.
+ Trying to use ! to access a non-existent optional value triggers a runtime
+ error. Always make sure that an optional contains a non-nil value before
+ using ! to force-unwrap its value.
*/
// implicitly unwrapped optional