Creating a list of symbols using a comprehension

I would like to create a list of symbols. I’m currently using the code

[Symbol(“M$i”) for i = 1:10]

I’m wondering if this is the best way to accomplish this or if there is a shorter method, something like

[:M$i for i = 1:10]

Thanks

You could do

[Symbol("M", i) for i in 1:10]

or

Symbol.("M", 1:10)
2 Likes

Thanks for the suggestions. I like that second version.