DEV Community

Pandademic
Pandademic

Posted on • Updated on

Go : Creating a variable which has the name of another variables value

Is this possible:
something like

one := "Hello"
var {substitute the value of 'one' here} = "did it work"
Enter fullscreen mode Exit fullscreen mode

I tried:

one := "hewo"
string(one) :=  "but this doesn't work either"
Enter fullscreen mode Exit fullscreen mode

Do you know how to do this or if this is even possible?

Oldest comments (0)