Reputation: 21
file A
package main
import "fmt"
func main() {
fmt.Println(My_str)
}
file B
package main
var My_str string
My_str = "hi"
run program with this command
go run .
but this error appears:
undefined: My_str
Upvotes: 0
Views: 74
Reputation: 21
I change declare variable to this :
var My_str = "hi"
but this is'n solved and say:
undefined: My_str
Upvotes: 1