go if for while 的使用

fileName := "a.txt"
contents ,err := ioutil.ReadFile(fileName)
if err != nil{
fmt.Println("文件不存在")
}else{
fmt.Printf("%s\n",contents)
}
fileName := "a.txt"
if contents ,err := ioutil.ReadFile(fileName);err!=nil{
 fmt.Println("文件不存在")
}else{
 fmt.Printf("%s\n",contents)
}
go 语言的switch 默认会加break
var c = 2
switch c {
case 1 :
fmt.Print(c)
case 2:
fmt.Print("hello")
case 3:
fmt.Print("world")
default:
fmt.Println("this is the end")
switch 后面可以不跟表达式
var score = 80