Latest Post:
IF – THEN Percentage Example
This sample code checks to see if a given year is a LEAP year…
var aYear = Int.self
func isLeap(year: Int) {
var leap = "NO"
//IF divisible by 4 with no remainders.
if year % 4 == 0 {
leap = "YES"
//Is leap year, unless:
}
if year % 100 == 0 {
leap = "NO"
//Is not leap year, unless:
}
if year % 400 == 0 {
leap = "YES"
//Is leap year.
}
print(leap)
}
//Input a Year Below...
isLeap(year: 2600)