Files
the-way-to-go_ZH_CN/eBook/exercises/chapter_4/function_calls_function.go
2013-06-09 20:18:11 +08:00

18 lines
239 B
Go

package main
var a string // global scope
func main() {
a = "G"
print(a)
f1()
}
func f1() {
a := "O" // new local variable a, only scoped within f1() !
print(a)
f2()
}
func f2() {
print(a) // global variable is taken
}
// GOG