I’ve been poking around for a while, and I was working with a part of my project that wanted a two dimensional vector.
I know that my examples aren’t correct syntax but I was trying to do something like
type Vector_2 is ( Float, Float );.
What I’m after is the declaration closest to the above, and assignment that looks like My_Vector_2 : Vector_2 := ( 1.0, 2.0 )
This could also be achieved with type Vector_2 is array(1..2) of Float; and My_Vector_2 : Vector_2 := ( 1.0, 2.0 );
I know the correct way should be something like:
type Vector_2 is record
X : Float; -- or even x,y : Float;
Y : Float;
end record;
My_Vector_2 : Vector_2 := ( 1.0, 2.0 );
I think I already solved my problem while writing this post, but I’m going to put it up anyways to see if I missed anything.
Skipping the naming on something like this is a footgun for sure, though I don’t see why I shouldn’t be able to make a type of two? I’m going to have to make lots of these, is there a way like the first example where I don’t have to name anything, or will I have to just bite it and use the records?