I would like to have a function inside of a mutable struct that is able to modify the value of the attributes from the struct when called.
As a test, I tried a simple
mutable struct Test
a
b
function init_test()
print(a)
a = 5
print(a)
end
init_test()
end
t = Test(3,3)
However this returns :
ERROR: LoadError: UndefVarError: a not defined
I searched through the doc, github and the forum but didn’t find any way to do this, which is surprising since it seems to be something quite basic. What am I doing wrong ?