# String as a variable name

**URL:** <https://discourse.julialang.org/t/string-as-a-variable-name/2195>\
**Category:** General Usage\
**Created:** [February 21, 2017, 1:43am UTC](https://discourse.julialang.org/t/string-as-a-variable-name/2195 "2017-02-21T01:43:29Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [July 24, 2020, 5:32am UTC](https://discourse.julialang.org/t/string-as-a-variable-name/2195/21 "2020-07-24T05:32:31Z")

</div>

From this [StackOverflow thread](https://stackoverflow.com/questions/50084877/how-to-alias-a-macro-in-julia), in Julia 1.3 there is convenient syntax `var"name"` to evaluate a _name string_ into a variable. The documentation is [here](https://docs.julialang.org/en/v1/base/base/#var%22name%22) (thanks to @Tamas_Papp). See examples below with Julia 1.4.2.

```julia-repl
julia> a = [1, 2, 3];

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

```

or create a new variable by assignment

```julia-repl
julia> var"msg" = "Hello, world!";

julia> msg
"Hello, world!"

```

---

_[View the full topic](https://discourse.julialang.org/t/string-as-a-variable-name/2195)._
