PMU_Petrushin_PIbd-32/lib/year.dart

19 lines
384 B
Dart
Raw Normal View History

2024-09-09 23:40:09 +04:00
class Year {
final String comment;
final int year;
final bool isLeap;
Year(this.comment, {required this.year}) : isLeap = _isLeapYear(year);
static bool _isLeapYear(int year) {
if (year % 4 != 0) {
return false;
} else if (year % 100 != 0) {
return true;
} else if (year % 400 != 0) {
return false;
} else {
return true;
}
}
}