Skip to content

Instantly share code, notes, and snippets.

@Agilulfe
Created September 9, 2020 14:35
Show Gist options
  • Save Agilulfe/c3eb4fc340615a29e99f92a2748bf582 to your computer and use it in GitHub Desktop.
Save Agilulfe/c3eb4fc340615a29e99f92a2748bf582 to your computer and use it in GitHub Desktop.
Go scope with an error
package main
import "fmt"
func main() {
x := "Hello, Scope!"
fmt.Println(x)
testScope()
}
func testScope() {
fmt.Println(x, "test")
}
// This program won't compile, as x is undefined in the testScope function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment