package main
import (
"fmt"
)
func main() {
x := 1
fmt.Println(&x, x)
if x, y := 3, 4; true {
x = x + y
fmt.Println(&x, x, y)
}
fmt.Println(&x, x)
x , y := 5, 6
x = x + y
fmt.Println(&x, x, y)
}
package main
import (
"fmt"
)
func main() {
x := 1
fmt.Println(&x, x)
if x, y := 3, 4; true {
x = x + y
fmt.Println(&x, x, y)
}
fmt.Println(&x, x)
x , y := 5, 6
x = x + y
fmt.Println(&x, x, y)
}
本文标题:golang 变量作用域之一
本文链接:https://www.haomeiwen.com/subject/yrtiphtx.html
网友评论