Files
the-way-to-go_ZH_CN/eBook/exercises/chapter_4/global_scope.go
2017-02-10 16:33:02 +08:00

21 lines
187 B
Go
Executable File

package main
var a = "G" // global scope
func main() {
n()
m()
n()
}
func n() {
print(a)
}
func m() {
a = "O" // simple assignment: global a gets a new value
print(a)
}
// GOO