Generate nonlinear expressions in an explicit loop

question
jump

#1

I want to generate nonlinear expressions in an explicit loop. I know You can iterate over constraints and store references like in the next example:

@variable(m, x[1:5] >= 0)
@constraintref myCons[1:5]
for i = 1:5
  myCons[i] = @constraint(m, x[i] >= i)
end

so, I wonder if there is one way to do the same with nonlinear expressions?