Initialize a variable inside a struct

The Base.@kwdef macro allows you to use the c = 3 syntax:

julia> Base.@kwdef mutable struct Test
         a
         b
         c = 3
       end
Test

julia> t = Test(a=1, b=2)
Test(1, 2, 3)
10 Likes