Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
languagenone
function days = daysInMonth(monthNumber)
switch ( monthNumber )
    case {1, 3, 5, 7, 8, 10, 12}
        days = 31;
    case {4, 6, 9, 11}
        days = 30;
    case 2
        days = 28;
    otherwise
        days = 0;
end
end

...

Code Block
languagenone
function bool = isLeapYear(year)
bool = (year > 0 && mod(year, 4) == 0 &&  (~mod(year, 100) == 0 || mod(year, 400) == 0));
end

Da blir den oppdaterte daysInMonth-funksjonen slik:

...