init function

import --> const --> var --> init()

var num = setNumber()
func setNumber() int {
    return 42
}
func init() {
    num = 0
}
func main() {
    fmt.Println(num) // => 0
}
Comments