Hi All,
I am new to Go and trying to figure out difference between const vs var
variables memory usage and initialization.
I have following go code
// way 1
var a = []string{"abc", "def"}
// way 2
const (
a = "abc"
b = "def"
)
var a1 = []string{a, b}
my variables a and a1 are defined in a file and not inside any function. Is
there any difference in both ways. When I call variable a in any function
does it creates a copy everytime it is called? Can you please tell me what
happens when a or a1 is called and how they are referenced in memory when
called.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.