package main
import "fmt"
var i int = 100
func TestInt() {
defer func() {
i+=100
}()
fmt.Println(i)
//return
}
func main() {
fmt.Println(TestInt())
//fmt.Println(i)
}
报错:.\test19.go:17:21: TestInt() used as value
package main
import "fmt"
var i int = 100
func TestInt() {
defer func() {
i+=100
}()
fmt.Println(i)
//return
}
func main() {
fmt.Println(TestInt())
//fmt.Println(i)
}
报错:.\test19.go:17:21: TestInt() used as value