Task

Determine whether a given year is a leap year in the Gregorian calendar.



See also

 Leap year (wiki)


function isLeapYear year
    return (year MOD 4 is 0) AND ((year MOD 400 is 0) OR (year MOD 100 is not 0))
end isLeapYear
 
command testLeapYear
    set itemDelimiter to comma
    put  "1900,1994,1996,1997,2000" into years
    repeat for each item y in years
        put y && "is" && isLeapYear(y) && return after tyears
    end repeat
    put tyears
end testLeapYear
 
1900 is false 
1994 is false 
1996 is true 
1997 is false 
2000 is true 