Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func isLeapYear(_ year: Int) -> Bool {
- var divBy4:Bool = false
- var divBy100:Bool = false
- var divBy400:Bool = false
- if number(year, isDivisibleBy: 4) {
- return divBy4 == true
- } else {
- return divBy4 == false
- }
- if number(year, isDivisibleBy: 100) {
- return divBy100 == true
- } else {
- return divBy100 == false
- }
- if number(year, isDivisibleBy: 400) {
- return divBy400 == true } else {
- return divBy400 == false
- }
- if divBy4 && !divBy100 && divBy400 {
- return true
- } else {
- return false
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement