M marcopoilo Member Licensed User Jul 12, 2020 #1 Is it possible to initialize a multi-dimension array as for one dimension. For example as (which does not work): Dim y(2,3) As Double y = Array As Double((1,2),(3,4),(5,6))
Is it possible to initialize a multi-dimension array as for one dimension. For example as (which does not work): Dim y(2,3) As Double y = Array As Double((1,2),(3,4),(5,6))
Erel B4X founder Staff member Licensed User Longtime User Jul 12, 2020 #2 There is no special syntax for multi-dimension arrays. However you can for example create a list of points: Code: Copy Dim Points As List = Array(Array As Double(1, 2), Array As Double(3, 4), Array As Double(5, 6)) For Each point() As Double In Points Log(point(0) & " x " & point(1)) Next Or better, declare your own custom type, hover over the type, choose "generate Create Type sub' and use it to create a list of custom types. Upvote 0
There is no special syntax for multi-dimension arrays. However you can for example create a list of points: Code: Copy Dim Points As List = Array(Array As Double(1, 2), Array As Double(3, 4), Array As Double(5, 6)) For Each point() As Double In Points Log(point(0) & " x " & point(1)) Next Or better, declare your own custom type, hover over the type, choose "generate Create Type sub' and use it to create a list of custom types.