Last active
July 15, 2020 14:29
-
-
Save yacir/58283aed0e43848a64f7317c8f5ad1f0 to your computer and use it in GitHub Desktop.
A simple πΆππ’π±π± & πΆππππ²π» extension to the ππ»ππ²π΄π²πΏ type, which might come handy in many situations.
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 BinaryInteger { | |
/// Returns true if and only if this integer is even. | |
var isEven: Bool { return self % 2 == 0 } | |
/// Returns true if and only if this integer is odd. | |
var isOdd: Bool { return self % 2 != 0 } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment