# Macro question (create variables)

**URL:** <https://discourse.julialang.org/t/macro-question-create-variables/90160>\
**Category:** General Usage\
**Tags:** macros, metaprogramming\
**Created:** [November 12, 2022, 11:35am UTC](https://discourse.julialang.org/t/macro-question-create-variables/90160 "2022-11-12T11:35:19Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [November 12, 2022, 8:51pm UTC](https://discourse.julialang.org/t/macro-question-create-variables/90160/3 "2022-11-12T20:51:45Z")

</div>

[bertschi](https://discourse.julialang.org/u/bertschi) thank you for the detailed explanation.

After some searching (specifically [this](https://discourse.julialang.org/t/can-i-concatenate-expressions-in-macro/69220/5) and [this](https://discourse.julialang.org/t/how-does-julia-merge-several-exprs-to-one-expr/77498/4) topics were useful) and some experimenting I got solution for multiple arguments:

```julia
foo(x) = "$x-$x" 

macro moo2(args...) 
    v = [:($x = foo($(string(x)))) for x in args]
    return esc(Expr(:block, v...))
end

@moo2 w1 w2
@show w1 w2;

julia> 

w1 = "w1-w1"
w2 = "w2-w2"

```

Now, can anybody explain me why do I need this `esc` here in the `return` statement?

---

_[View the full topic](https://discourse.julialang.org/t/macro-question-create-variables/90160)._
