...
Da blir den oppdaterte daysInMonth-funksjonen slik:
Code Block | ||
---|---|---|
| ||
...function days = daysInMonth(monthNumber, year) switch (monthNumber) case {1, 3, 5, 7, 8, 10, 12} days = 31; case {4, 6, 9, 11} days = 30; case 2 days = 28 + isLeapYear(year); otherwise days case 3= 0; end end |