Created
August 11, 2018 01:54
-
-
Save mildocjr/0c3c97c4ca60b96e3a7e9fa98b733ea5 to your computer and use it in GitHub Desktop.
if-let-3
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
func add(firstPossibleInteger: Int?, secondPossibleInteger: Int?) -> Int? { | |
guard let firstNumber = firstPossibleInteger, | |
let secondNumber = secondPossibleNumber | |
else { return nil } // or 0 if you want to return a | |
// non-optional value | |
return (firstNumber + secondNumber) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment