type Day is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); subtype Weekday is Day range Monday .. Friday; subtype Weekend is Day range Saturday .. Sunday; -- ... some time later Today : Day; -- ... Here's an example of setting Today to a value. Today := Tuesday;
Here's a simplified BNF for declaring enumeration types:
enumeration_type_declaration ::= "(" enumeration_literal_specification { "," enumeration_literal_specification } ")"
It happens that the Boolean type mentioned earlier is an Enumeration type with only two values - True and False.
There is no quiz question for this section.
You may go to the next section.
![]() |
![]() |
---|
David A. Wheeler (dwheeler@ida.org)