summaryrefslogtreecommitdiffhomepage
path: root/swift.html.markdown
diff options
context:
space:
mode:
authorgprasant <nagu89@gmail.com>2016-02-19 08:13:46 -0800
committergprasant <nagu89@gmail.com>2016-02-19 08:13:46 -0800
commit48b2244ac353890d7ebf3ecff908a6baab625ebb (patch)
tree436049532a9ee3402850dfb1440a769b216af5ae /swift.html.markdown
parent8d6d142e4afab0c6f9c3e27aef67bb82ac83587c (diff)
Add documentation comment for If let
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") {