March 2019
Intermediate to advanced
208 pages
5h 11m
English
Tuples were adequate for defining a data type for an order of shirts expressed as the quantity of shirts and the shirt size, as we saw . But there’s more to shirts than just their size. You need to know whether each one is long-sleeved or short-sleeved, the color, pattern, type of cuff, and type of collar. This is definitely not a job for a tuple. There are seven pieces of data, and I’ll bet if you walk away from this book for five minutes, you won’t remember what order they are in.
First, let’s define some data types for size, sleeve length, color, pattern, cuff, and collar:
| | type size = |
| | | XSmall(int) |
| | | Small |
| | | Medium |
| | | Large |
| | | XLarge(int); |
| | |
| | type sleeve = |
| |
Read now
Unlock full access