Last active
November 6, 2018 02:52
-
-
Save dmlebron/741b46d7d9964686704c1ab371124dd4 to your computer and use it in GitHub Desktop.
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
extension Optional where Wrapped == Int { | |
var unwrappedOrZero: Int { | |
switch self { | |
case .some(let unwrapped): | |
return unwrapped | |
case .none: | |
return 0 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment