summaryrefslogtreecommitdiffhomepage
path: root/swift.html.markdown
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2015-01-20 22:57:49 +0000
committerAdam Bard <github@adambard.com>2015-01-20 22:57:49 +0000
commite6930e4b67cc0c979e898370c15dea521f30de58 (patch)
tree77ecae1c1f7a9f334faa4ecf18fc1b67d0cb442a /swift.html.markdown
parent6915f5bfd065434a24e52bf6b9fe2007b011e6cd (diff)
parent7a55b4a9b1badebd4b9342304c902fde049dd172 (diff)
Merge pull request #935 from keito/master
Explain Optional Chaining
Diffstat (limited to 'swift.html.markdown')
-rw-r--r--swift.html.markdown5
1 files changed, 4 insertions, 1 deletions
diff --git a/swift.html.markdown b/swift.html.markdown
index 2fbbe544..c6d2a8af 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -445,7 +445,10 @@ class MyShape: Rect {
func grow() {
sideLength += 2
-
+
+ // Place a question mark after an optional property, method, or
+ // subscript to gracefully ignore a nil value and return nil
+ // instead of throwing a runtime error ("optional chaining").
if let allow = self.delegate?.canReshape?() {
// test for delegate then for method
self.delegate?.reshaped?()