Golang中 unreachable code 提示出现的原因
出现unreachable code提示,是因为有代码无论如何都不会被执行;
比如在Golang中,有代码出现在return关键字后:
package main
import(
"fmt"
}
func main(){
return
fmt.Println("hello")
}
第10行代码出现在return后,无论如何都不会被执行。
如需转载,请注明出处;本文地址:https://www.perfcode.com/p/unreachable-code.html