Welcome Guest, you are in: Login

Fruit Of The Shed

Navigation (MMBasic)






Search the wiki

»


Page History: IsLeapYear Function to determine if the given year is a Leap Year on the Gregorian (western) calendar

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: 2017/08/03 06:10


The following is an MMBasic function to indicate that the given year is a leap year.

It simply returns a Boolean (actually an integer) of 1 if the year is leap or 0 if not.

Syntax:
IsLeapYear(year)

Example Usage:
DaysInYear=365+IsLeapYear(year)
or
If IsLeapYear(year) Then ...

	Function IsLeapYear(n as integer) as integer
		If ((n Mod 4=0) And (n Mod 100 <>0)) Or (n Mod 400=0) Then
			IsLeapYear=1
		Else
			IsLeapYear=0
		EndIf
	End Function