4.5.2.5.md

This commit is contained in:
Unknown
2013-06-09 20:18:11 +08:00
parent 146c81bd01
commit 4de688c86a
7 changed files with 114 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
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