Enum

The enum data type will have a named set of values. We use enumerators to give friendly names to constants that identify certain values:

enum Day {Mon, Tue, Wed, Thu, Fri, Sat, Sun}; 
let firstDay: Day = Day.Mon;

Here, we have the enum type Day variable that holds the series of values representing each day of a week. The second statement shows how to access a particular enum value in a day and assign the same to another variable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset