Hello,
I would like to know if there exists any concise solution to create a struct which can be initialised with any number of arguments? like so:
struct VariableStruct
a
b
c
d
e
f
return new(;a,b,c,d,e,f)
end
- With one argument
So now if I would like to initiate a new instance of VariableStruct with only say e declared like so:
myVar= VariableStruct(e=5)
then I’d like myVar to be initialised as VariableStruct(nothing, nothing,nothing, nothing,5,nothing)
- With say 3 arguments
Initiate a new instance of VariableStruct with only say a,d,e declared like so:
myVar = VariableStruct(a=1,d=3,e=5)
then I’d like myVar to be initialised as VariableStruct(1, nothing,nothing, 3 ,5 ,nothing)
Does this functionality exist? Or in other words how to achieve it?
As you may noticed I used Kwargs, this is an idea I have preemptively tried to put in my question ![]()