summaryrefslogtreecommitdiffhomepage
path: root/swift.html.markdown
diff options
context:
space:
mode:
authorShawn Zhang <shawnzhang009@gmail.com>2016-03-15 11:42:20 +0800
committerShawn Zhang <shawnzhang009@gmail.com>2016-03-15 11:42:20 +0800
commitb38a7645366b1580b5f554303e411447c7d2d09d (patch)
treecfe5c9e59fa1f3611a5b5545f9b2d74cbac461f2 /swift.html.markdown
parent072424afd77b9d772102f83508fcc337ffc81a7d (diff)
parentfbe11b52d5fe839f791935012b93ff8ef2ac91f6 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'swift.html.markdown')
-rw-r--r--swift.html.markdown2
1 files changed, 2 insertions, 0 deletions
diff --git a/swift.html.markdown b/swift.html.markdown
index 46768375..e921e7ea 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -94,6 +94,8 @@ var unwrappedString: String! = "Value is expected."
// same as above, but ! is a postfix operator (more syntax candy)
var unwrappedString2: ImplicitlyUnwrappedOptional<String> = "Value is expected."
+// If let structure -
+// If let is a special structure in Swift that allows you to check if an Optional rhs holds a value, and in case it does - unwraps and assigns it to the lhs.
if let someOptionalStringConstant = someOptionalString {
// has `Some` value, non-nil
if !someOptionalStringConstant.hasPrefix("ok") {