enum
rank:
Int
{
caser1 =1 caser2 =2 caser3 =3 funcdescription()->String{//enum转String switch(self){ caser1: return"R1"; caser2: "R2"; caser3: "R3"; } } } varr:rank=rank.r2;//普通初始化 var@H_403_106@rraw =r@H_403_106@.rawValue@H_403_106@;//enum to int println@H_403_106@(.description@H_403_106@());//enum转String letnewr =rank(rawValue:3);//int to enum |