Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / ARRAY INSERT AT BOTTOM for a 2 dimension array

Author
Message
Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 15th May 2010 12:58
Hi all. I have this array




Ok, i would to add the array cells just when i need it so i can use the "ARRAY INSERT AT BOTTOM" command. But this command work on single dimension array or i can use it in my example too?

I need something like that:


..but what of the 2 dimension gets the cell add? the first or the second?
Are there some ways to add a cell in the wanted array dimension?

Thanks
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th May 2010 20:09
Just DIM it to the new size - all existing array elements should be kept unchanged.

Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 15th May 2010 20:57
Ah interesting! I thought when i DIM an existing array I lost all the content!
Good news so!

Thank you!
Sepnon
16
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Brazil
Posted: 16th May 2010 02:25
arrays are rezisable? isn't that called dynamic arrays?
i feel like a newbie now
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th May 2010 06:35
Quote: "Just DIM it to the new size - all existing array elements should be kept unchanged.
"


X_X I didn't know that. I used the stuff I was talking about in alduce's other post (like, dim arr(10,10) : print array count(arr()) and how it prints out 120), and did inserting at element and crap.

:\


IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th May 2010 13:48
Quite some time ago we were pushing Lee for a REDIM command - his response was to extend the DIM command to do the same job. If you want a cleared and resized array now, you UNDIM it first.

The ARRAY INSERT * commands were modified long ago to stop them from working on multi-dimensional arrays - when you ARRAY INSERT AT BOTTOM on a 2D array, which dimension do you extend? What if you want to extend different dimensions at different times?

Anyway, those are the thought processes behind the array system right now.

Login to post a reply

Server time is: 2026-07-25 23:10:47
Your offset time is: 2026-07-25 23:10:47