[Gambas-user] Array.Add question
Tobias Boege
taboege at ...626...
Wed Jul 15 15:41:51 CEST 2015
On Wed, 15 Jul 2015, Rolf-Werner Eilert wrote:
> Sometimes... ok: Never done this before, so I just ask:
>
> Dim sTest as String[0,0]
>
> sTest.Add("Hello", "World")
>
> Where is "Hello" now? At 0,0 or 1,1? Or: Which dimension is added?
>
> Is that possible - or are multi-dimensional arrays not dynamic?
>
If Benoit didn't change it (I lost track of all the changes lately due to
exams), multidimensional arrays are static in size. One reason may be
precisely that the choice of a particular dimension to which an Add()
method would add elements is hard to justify.
[ One additional point may be memory consumption: we imagine an n-
dimensional array as an n-dimensional hyperrectangle. If we increment
the size in one dimension, a whole (n-1)-dimensional hyperrectangle has
to be added. ]
Anyway, if you want a refresher on your options regarding arrays in Gambas,
I already wrote about it on this list [0] and even in German [1]. You may
want to use what we call "derived" multidimensional arrays.
Regards,
Tobi
[0] http://sourceforge.net/p/gambas/mailman/message/32228140/
[1] http://gambas-club.de/viewtopic.php?f=3&t=4688&p=9975#p9975
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list