neoHOW6: Check if a particular year is a LEAP year


By definition, a year is a LEAP year if all of theese conditions are true ...

a) The number is a whole multiple of 4
b) If the number is a whole multiple of 100 it is also a whole multiple of 400

So, 1600 and 2000 are LEAP years ... but 1700, 1800, 1900 and 2100 are NOT LEAP years.

You deploy this subroutine (IsThisALeapYear) by supplying the value to be checked in variable [IsThisALeapYear/Input] ... and upon return, examine the contents of [IsThisAleapYear/Answer] for values "True" or "False"... here is an example code snippet ...



Note that the subroutine expects the year to include the century ... if you supply the short form value of (say) 32, it will be treated like the year 32 (i.e. in the first century).

And here is the subroutine you would paste in your pub's SubRoutines section ...



Of course, if you plan on using such a function in many projects, you might consider turning the subroutine into a NeoBook Function ... something you might Call from any pub in your computer ... for example ...

Back