diff options
author | Adam Bard <github@adambard.com> | 2016-02-20 19:06:47 -0800 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2016-02-20 19:06:47 -0800 |
commit | 9c2bfcc46a2c4c6ae6fbb938807df20d544d390e (patch) | |
tree | 1e06c31e40e4ef6fd528a3f9fdeed643aa344ccc | |
parent | 4c8db7ae471dd023f373479d0d311d330f10eece (diff) | |
parent | 48b2244ac353890d7ebf3ecff908a6baab625ebb (diff) |
Merge pull request #2148 from gprasant/patch-1
Add documentation comment for If let
-rw-r--r-- | swift.html.markdown | 2 |
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") { |