How to programmatically create symbolic variable names in Symbolics.jl

Essentially, I am looping over indices and I need to use those indices to create symbolic variable names.

A simplified version of what I am trying to do as shown using SymPy:

vars=[]
for i=1:5
   for j=2:7
       push!(vars,symbols("x$i$j"))
   end
end

In actuality, the indices are all coming from a list so it is not straightforward to program using for loops.

The only method for defining symbolic variables I can find for Symbolics.jl is

@variables x1

Does anyone have suggestions for how I can incorporate the x$i symbolic variable construction in Symbolics? Thank you.

@variables $x

Can you elaborate? Is x supposed to be assigned as something beforehand?

yes it’s interpolating in a name.

I’ve tried different formulations but can’t seem to figure out what the requirements on x are. Can you show an example of how x is defined before @variables $x?

x = :myvar