1 -- main-next_month.adb: function to compute next month 2 3 separate (Main) 4 5 function Next_Month (Month: Month_Type) return Month_Type is 6 7 -- the position of the enumeration literals are: 0, 1, ..., N-1 8 N : constant Integer := Month_Type'Pos (Month_Type'Last) + 1; 9 10 begin 11 12 return (Month_Type'Val ((Month_Type'Pos(Month) + 1) mod N)); 13 14 end Next_Month;