Scopes
scope = visibility
there are 3 scopes
- file scope
- package scope
- block -local- scope
import "fmt" // file scope
import f "fmt" // alias import
const pi = 3.14 // package scope
func main() {
x := 10 // local(block) scope
f.Println(x)
fmt.Println(x)
}
- import statements are file scoped
Top comments (0)