Program 5.1 illustrates some operations on data having an enumerated type. 

program DayTime(Output); { Program 5.1 - Illustrate enumerated types. } type Days When (Mon, Tue, Wed, Thu, Fri, Sat, Sun); (Past, Present, Future); var Day: Days; Yesterday, Today, Tomorrow: Days; Time: When; begin Today := Sun Pascal can't read a value of an emumerated type from Input. }; Time := Present; repeat case Time of Present: begin {Calculate Yesterday} Time := Past; if Today = Mon then Yesterday := Sun else Yesterday := pred(Today); Day := Yesterday; Write (Output, 'Yesterday'); end; Past: begin {Calculate Tomorrow Time := Future; if Today = Sun then Tomorrow := Mon else Tomorrow := succ(Today); Day := Tomorrow; Write (Output, 'Tomorrow'); end; Future: begin {Reset to Present Time := Present; Day .- Today; Write (Output, 'Today'); end; end; case Day of Mon: Write (Output, Tue: Write (Output, Wed: Write (Output, Thu: Write (Output, Fri: Write (Output, Sat: Write (Output, Sun: Write (Output, end; 'Monday' ) ; 'Tuesday'); , Wednesday' ) ; , Thursday' ) ; , Friday') ; , Saturday') ; , Sunday' ) Writeln(Output, Ord(Time) - 1) until Time = Present end . 

