Created
April 16, 2017 22:13
-
-
Save inizovtsev/677269983b0a4e5726ee2ec893f60743 to your computer and use it in GitHub Desktop.
golang initialization order
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 | |
var answer = say() | |
func main() { | |
println("And that was the question?") | |
} | |
func say() int { | |
println("That is the answer?") | |
return 42 | |
} | |
func init() { | |
println("The answer is", answer) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment