package main import "fmt" /** * An attempt to show that even numbers are not immutable in go. * This example is as parallel as I can make to a similar elixir program. * The idea here is the makefun() function declares a new variable "a". * Then creates a function. Then change the value stored with a. And * finally returns the function. If a was truly a variable, then * when execute the returned function * should print the changed value of a. If immutable, then the original value. * This is not a perfect test, but it is the best I can think of. *Author gtowell *Created Oct 2022 */ func main() { f := makefun() f() } // see top level documentation func makefun() func() { a:=5 b:=func() { fmt.Println(a) } a=10 b() return b }