How to add a check between elements of a structure?
For instance, how this example couold work?
struct paramChecked
a::Real
b::Real
if(a>b)
error("a > b")
end
end
Thanks
How to add a check between elements of a structure?
For instance, how this example couold work?
struct paramChecked
a::Real
b::Real
if(a>b)
error("a > b")
end
end
Thanks
here is the relevant section of the manual: Constructors · The Julia Language
Thank you.
I’v already seen it but was not able to reuse it with several variable ; but now ok, so here is the minimal example I needed:
struct paramChecked
a::Real
b::Real
c::Real
d::Real
e::Real
paramChecked(a,b,c,d,e) = a > b || c < d ? error("out of order") : new(a,b,c,d,e)
end