Enum Case Of



Enum Case Of
Smart pascal source code
type TWeekdays = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); var weekDay: TWeekdays; weekDay := TWeekdays.Wednesday; case weekDay of Monday: WriteLn('Monday'); Tuesday: WriteLn('Tuesday'); Wednesday: WriteLn('Wednesday'); Thursday: WriteLn('Thursday'); Friday: WriteLn('Friday'); Saturday: WriteLn('Saturday'); TWeekdays.Sunday: WriteLn('Sunday'); end; WriteLn(Integer(Saturday)); type TMonths = (January = 1, February = 2, March = 3, April = 4, May = 5, June = 6, July = 7, August = 8, September = 9, October = 10, November = 11, December = 12, FirstMonth = 1, SecondMonth = 2); WriteLn(Ord(Monday)); WriteLn('..'); WriteLn(Ord(Sunday)); { <<< CONSOLE OUTPUTS >>> Wednesday 5 0..6 }