Help me with @eval

You don’t need @eval, you can assign the value to a field with setproprerty!:

julia> mutable struct Test
                  field_1
                  field_2
                  field_3
          end

julia> function test_run()
           test = Test(0,0,0)
           for field_number in 1:3
               setproperty!(test, Symbol(:field_, field_number), field_number)
           end
           test
       end
test_run (generic function with 1 method)

julia> test_run()
Test(1, 2, 3)
4 Likes