Sha256: 41aeef46b84b5cf738f865f072bff05e2981ceab040c668172b2c42bf8a2fea7

Contents?: true

Size: 384 Bytes

Versions: 24

Compression:

Stored size: 384 Bytes

Contents

function Test-LeapYear {
    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
    if ( $year % 4 -eq 0 -and $year % 100 -ne 0 -or $year % 400 -eq 0) {
        return $True
    }
    else {
        return $False
    }
}

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trackler-2.2.1.169 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.167 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.166 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.165 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.164 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.163 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.162 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.161 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.160 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.159 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.158 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.157 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.156 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.155 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.154 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.153 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.152 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.151 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.150 tracks/powershell/exercises/leap/LeapYear.example.ps1
trackler-2.2.1.149 tracks/powershell/exercises/leap/LeapYear.example.ps1