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 / The DIM Command...

Author
Message
Mike P
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: England
Posted: 30th Dec 2004 17:57 Edited at: 30th Dec 2004 17:58
I just do not understand the dim command.

1. Whats all this elements stuff???
2. Why can you just use normal variables??

Help Me

Worship Me OR DIE
BlinkOk
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location:
Posted: 30th Dec 2004 18:10
dim is short for dimension as in dimension an array. array's are handy for storing information in tables. anything that needs to be indexed should be stored in an array. if i had say 10 sprites on screen i could access each sprite by placing their image number in an array;
dim sprites(10)
then i could access each one in a loop like;
for i=0 to 9 step 1
img=sprites(i)
`code to manipulate image
next i

P4 2.8Ghz, 2Gb, 128Mb Radeon Pro, Dark Basic PRO
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 30th Dec 2004 18:24
Allass..... I have an array tutorial on my site... press da web button or click on my banner.

Mike P
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: England
Posted: 30th Dec 2004 20:20
Thanks that helped

Worship Me OR DIE
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 31st Dec 2004 21:40 Edited at: 31st Dec 2004 21:42
DIM makes sure that your array's reserve memory. This is the general idea...I'm sure there's more too it than just that.

Since your array's have to store data, you want to DIMensionise them to make sure you have that memory available in the first place. This reserves the memory for your array.

Login to post a reply

Server time is: 2025-06-04 18:22:34
Your offset time is: 2025-06-04 18:22:34