Skip to content

Instantly share code, notes, and snippets.

@HemantNegi
Created October 30, 2018 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HemantNegi/344ecccb54d4eda3cc2a2b827f2e34a5 to your computer and use it in GitHub Desktop.
Save HemantNegi/344ecccb54d4eda3cc2a2b827f2e34a5 to your computer and use it in GitHub Desktop.
//Enter your code here. Read input from STDIN. Print output to STDOUT
//
//What is the execution order in the following program, and also the output ?
package main
import "fmt"
var WhatIsThe = AnswerToLife()
func AnswerToLife() int {
fmt.Println("asdfasdfasdf")
return 42
}
func init() {
WhatIsThe = 0
}
func main() {
if WhatIsThe == 0 {
fmt.Println("It's all a lie.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment