Created
September 9, 2020 14:35
-
-
Save Agilulfe/c3eb4fc340615a29e99f92a2748bf582 to your computer and use it in GitHub Desktop.
Go scope with an error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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