String as a variable name

From this StackOverflow thread, in Julia 1.3 there is convenient syntax var"name" to evaluate a name string into a variable. The documentation is here (thanks to @Tamas_Papp). See examples below with Julia 1.4.2.

julia> a = [1, 2, 3];

julia> var"a"
3-element Array{Int64,1}:
 1
 2
 3

or create a new variable by assignment

julia> var"msg" = "Hello, world!";

julia> msg
"Hello, world!"
3 Likes