title: How to define JuMP variables using for loop in Julia?
body: <p>I am new to Julia, and I am trying to define an optimization problem with <a href="https://github.com/JuliaOpt/JuMP.jl" rel="nofollow">JuMP</a>. I have a lot of variables (<code>x1,x2,x3....</code>) that I am trying to define using a <code>for</code> loop. I want to have the code:</p>
  
  <pre><code>@variable(m, x1&gt;=0)
  @variable(m, x2&gt;=0) ... 
  </code></pre>
  
  <p>However I wanted to use a <code>for</code> loop so I did not have to define every variable manually.<br>
  Here is what I have so far:</p>
  
  <pre><code>m = Model()
  for i = 1:2
      @variable(m,string('x',i)&gt;=0)
  end 
  </code></pre>
  
  <p>I know the <code>string('x',i)</code> part is not right but I am not sure how to do this using Julia.</p>