-
-
Save nickarthur/54e63109930cbb4522b934be1e98ff67 to your computer and use it in GitHub Desktop.
if-let-3
This file contains hidden or 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