Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DominikPetho/9513a23053088ef93487d0d94f701140 to your computer and use it in GitHub Desktop.
Save DominikPetho/9513a23053088ef93487d0d94f701140 to your computer and use it in GitHub Desktop.
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