A acorrias Member Licensed User Longtime User Sep 23, 2011 #1 Hi all. I'm going to develop a graphic app and I ned to use vectos with tow dimension. Type vector(x As Double, y As Double). then I have an array of vectors: Dim A(10) as vector Could you explain the meaning of initialize and how it set to default values. Is it possible to declare a default value for each type field? Should I have to initialize only the whole array with a.initialize or should I have to initialize next each array cell with for i=0 to 9: a(i).initialize: next? alex
Hi all. I'm going to develop a graphic app and I ned to use vectos with tow dimension. Type vector(x As Double, y As Double). then I have an array of vectors: Dim A(10) as vector Could you explain the meaning of initialize and how it set to default values. Is it possible to declare a default value for each type field? Should I have to initialize only the whole array with a.initialize or should I have to initialize next each array cell with for i=0 to 9: a(i).initialize: next? alex
Erel B4X founder Staff member Licensed User Longtime User Sep 24, 2011 #2 Calling Initialize is required when one or more of the fields are not of a "primitive" type (like numbers). In your case it is not needed. You can create a sub that will set the values to default. Upvote 0
Calling Initialize is required when one or more of the fields are not of a "primitive" type (like numbers). In your case it is not needed. You can create a sub that will set the values to default.
jinyistudio Well-Known Member Licensed User Longtime User Mar 26, 2015 #3 Hi Erel Could you give me a easy sample about the initialize Sub of the new Type ? Upvote 0
T Troberg Well-Known Member Licensed User Longtime User Mar 26, 2015 #4 Code: Copy Sub InitializeVector(V as Vector) V.x=0 V.y=0 End Sub Upvote 0