Code: Select all
Function LeapYear(ByVal yea As ULong) As Boolean
If (yea Mod 4) Then Return FALSE ' definitely NOT a leap Year
' below: exception test (a century but, not also clean dividable by 400)
If Not CBool(yea Mod 100) AndAlso CBool(yea Mod 400) Then Return FALSE
' below: all tests passed = it is, a leap Year
Return TRUE
End Function
Code: Select all
Function LeapYear(ByVal yea As ULong) As Boolean
If (yea Mod 4) Then Return FALSE ' definitely NOT a leap Year
' below: exception test (a century but, not also clean dividable by 400)
If (yea Mod 100 = 0) AndAlso (yea Mod 400 <> 0) Then Return FALSE
' below: all tests passed = it is, a leap Year
Return TRUE
End Function