groovy switch判断

groovy switch判断

条件判断

	//定义参数
      def color = "red"
      //switch判断 
      switch(color) { 
        case "red": 
          println("red")
          break
		case "blue":
          println("blue")
          break	
         //当匹配不到时
         default: 
            println("No matching case found!!"); 
      }
posted @ 2022-07-19 13:33  liwenchao1995  阅读(173)  评论(0编辑  收藏  举报