isLeapYear static method

bool isLeapYear(
  1. int year
)

Implementation

static bool isLeapYear(int year) {
  // A year is a leap year if it's divisible by 4 but not divisible by 100,
  // or if it's divisible by 400.
  return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}