首页 > 建站教程 > dart >  Dart编程实例 - Dart Switch Case 语句正文

Dart编程实例 - Dart Switch Case 语句

Dart编程实例 - Dart Switch Case 语句

void main() {

   var grade = "A";

   switch(grade) {

      case "A": {  print("Excellent"); }

      break;



      case "B": {  print("Good"); }

      break;



      case "C": {  print("Fair"); }

      break;



      case "D": {  print("Poor"); }

      break;



      default: { print("Invalid choice"); }

      break;

   }

}