You would use this syntax:
for var in (:var1, :var2, :var3)
mytype.(var) = ...
end
-erik
On Wed, Jan 20, 2016 at 2:10 PM, <[email protected]> wrote:
> I am trying to do something in Julia that s very easy to do in some other
> language (STATA for instance). I want to apply the same list of command to a
> set of variables. For instance:
>
> for each myvar in the set {variable1, variable2, variable2}:
>
> grid_"myvar" = linspace(lb_"myvar",ub_"myvar",size_grid)
>
> for ii=1:size_grid
> mytype."myvar" = grid_"myvar"[ii]
> vector_"myvar" = function(mytpe)
> end.
>
>
> In that stata i would simply do a loop for each and then use `myvar" when my
> variable name appears in the RHS or LHS of an equation.
>
> Thank you all!
>
>
>
--
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/