Created
August 31, 2015 05:17
-
-
Save rizumita/7eaab55942529b234f66 to your computer and use it in GitHub Desktop.
Int? = Int? + Int? in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a: Int? = 10 | |
let b: Int? = 20 | |
let values = [a, b].flatMap { $0 } | |
let c: Int? = values.isEmpty ? nil : values.reduce(0, combine: +) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment