exercism/go/leap/leap.go

16 lines
265 B
Go
Raw Normal View History

2016-08-13 23:20:14 +00:00
package leap
// TestVersion is an exercism thing.
const TestVersion = 1
// IsLeapYear returns whether the given year is a leap year.
func IsLeapYear(year int) bool {
if year%4 != 0 {
return false
}
if year%400 == 0 {
return true
}
return year%100 != 0
}