Skip to content

流程控制和其他语言基本相同

但是Dart有一个类似 C 语言goto的操作,具体看代码

dart
String command = "close";
switch (command) {
  case "open":
    print("open");
    break;
  case "close":
    print("close");
    continue doClear;
  case "close2":
    print("close2");
    continue doClear;
  doClear:
  case "doClose":
    print("doClose");
    break;
  default:
    print("other");
}

MIT License