Exercism: Go version of the 'Leap' exercise.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
334 B

package leap
const testVersion = 2
// IsLeapYear receives an integer year value and returns a boolean indicating
// whether the year is a leap year or not.
func IsLeapYear(year int) bool {
switch {
case year%400 == 0:
return true
case year%100 == 0:
return false
case year%4 == 0:
return true
default:
return false
}
}