首页 > 建站教程 > dart >  Dart编程实例 - 枚举正文

Dart编程实例 - 枚举

Dart编程实例 - 枚举

enum Status {

   none,

   running,

   stopped,

   paused

}  

void main() {

   print(Status.values);

   Status.values.forEach((v) => print('value: $v, index: ${v.index}'));

   print('running: ${Status.running}, ${Status.running.index}');

   print('running index: ${Status.values[1]}');

}