Created
January 28, 2019 11:55
-
-
Save salmaanahmed/f5d096d2222644f476f62380829d32d5 to your computer and use it in GitHub Desktop.
The problem with finding even number 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
// Swift: | |
7 % 2 == 1 // true | |
-7 % 2 == 1 // false. -7 % 2 evaluates to -1 | |
// Ruby and Python | |
7 % 2 == 1 // true | |
-7 % 2 == 1 // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment