列舉
用於命名一組數值的型別:
數值預設為 0:
enum Day { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
let bestDay: Day = Day.Saturday;
設定預設起始編號:
enum TenPlus { Ten = 10, Eleven, Twelve }
或指定值:
enum MyOddSet { Three = 3, Five = 5, Seven = 7, Nine = 9 }