10.1 switch.go_invalid case 'num1 < 60' in switch on 'num1' (mism-CSDN博客

网站介绍:文章浏览阅读115次。package mainimport "fmt"func sum() int { return 44}func test(x int) int { a := 5 b := 2 return a + b + x}func main() { //todo:示例一 switch后面有一个表达式,case后面有一到多个表达式,前面的case匹配 //到执行了,后面的case即使也匹配但不会执行;switch和case表达式最终的值的类型要一致 n := 44_invalid case 'num1 < 60' in switch on 'num1' (mismatched types 'bool' and 'i