tracks/powershell/exercises/leap/LeapYear.example.ps1 in trackler-2.2.1.169 vs tracks/powershell/exercises/leap/LeapYear.example.ps1 in trackler-2.2.1.170
- old
+ new
@@ -1,6 +1,33 @@
function Test-LeapYear {
+ <#
+ .SYNOPSIS
+ Given a year, report if it is a leap year.
+
+ .DESCRIPTION
+ Calculate whether the supplied year is a leap year. A leap year is determined from the following
+ calculation:
+
+ on every year that is evenly divisible by 4
+ except every year that is evenly divisible by 100
+ unless the year is also evenly divisible by 400
+
+ .PARAMETER year
+ The year to test
+
+ .EXAMPLE
+ Test-LeapYear -year 2018
+
+ Returns false
+
+ .EXAMPLE
+ Test-LeapYear -year 2020
+
+ Returns True
+ #>
+
param( [int]$year )
+
# This could be solved using the native system.datetime object
# but that isn't in the spirit of exercism.
#[system.datetime]::isleapyear($year)
# Instead solve using math