def level = $branches.switchCase(85) { add({ it >= 90 && it < 100 }) { "优秀" } add({ it >= 80 && it < 90 }) { "好" } add({ it >= 70 && it < 80 }) { "良" } add({ it >= 60 && it < 70 }) { "及格" } addDefault { "不及格" } } $console.log(level)