Created
March 7, 2020 09:58
-
-
Save DominikPetho/9513a23053088ef93487d0d94f701140 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
func isLeap(year: Int) -> Bool { | |
let isDivisibleBy4 = year % 4 == 0 | |
let isDivisibleBy100 = year % 100 == 0 | |
let isDivisibleBy400 = year % 400 == 0 | |
let isLeapYear = (isDivisibleBy4 && !isDivisibleBy100) || ( isDivisibleBy4 && isDivisibleBy400) | |
return isLeapYear | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment