16 lines
265 B
Go
16 lines
265 B
Go
|
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
|
||
|
}
|