Post

Replies

Boosts

Views

Activity

Reply to Leap Year Exercise in Lesson 11 (Making Decisions.Playground)
Here is my solution; I don't know if it can be done in an easier way but this is how I did it and it works: func isLeap(year: Int) {     if year % 4 == 0 && year % 100 != 0 && year % 400 == 0 {         print("YES")     } else if year % 4 == 0 && year % 400 == 0 {         print("YES")     } else if year % 4 == 0 && year % 100 != 0 {         print("YES")     } else if year % 100 == 0 {         print("NO")     } else {         print("NO")     } } isLeap(year: 2000) // write here whatever number you want
Aug ’21