mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 05:11:49 +08:00
05.0.md
This commit is contained in:
13
eBook/examples/chapter_5/goto2.go
Normal file
13
eBook/examples/chapter_5/goto2.go
Normal file
@@ -0,0 +1,13 @@
|
||||
// compile error goto2.go:8: goto TARGET jumps over declaration of b at goto2.go:8
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
a := 1
|
||||
goto TARGET // compile error
|
||||
b := 9
|
||||
TARGET:
|
||||
b += a
|
||||
fmt.Printf("a is %v *** b is %v", a, b)
|
||||
}
|
Reference in New Issue
Block a user