Special data types are specified by the programming language. One example is the enumeration. Let’s explore this data type.
Your key takeaways are:
- Special data types are specified by the programming language
- Enumeration is a common data type
- It is an example of using the right tool for the job
It’s a data type specific to a particular language. One fairly common data type is an enumeration.
Examples of Enumeration
enum Month (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC);
enum Season (SPRING, SUMMER, FALL, WINTER);
enum Users (SUBSCRIBER, CONTRIBUTOR, AUTHOR, EDITOR, ADMIN, SUPERADMIN);
enum Month (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
enum Season (0, 1, 2, 3);
enum Users (0, 1, 2, 3, 4, 5);
- Maps a number to a string representation
- You use the representation in your code
- Specifically designed for this purpose
- Less memory
Languages with Enumeration
- Visual Basic
Don’t repeat yourself. Don’t repeat yourself. Don’t repeat yourself.
Total Lab Runtime: 00:48:33