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 Discussion / Setting All the Values in an Array to the Same Thing

Author
Message
MaTt0344
21
Years of Service
User Offline
Joined: 6th Jan 2004
Location:
Posted: 17th Mar 2004 00:02
If say I have an array with 50 differnet values in it and I want to set them all to 10 then is there an easier and faster way of doing it that having the computer run the code:

DIM array(50)

for n=1 to 50
array(n)=10
next n
Code Ninja
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: AZ, U.S.
Posted: 17th Mar 2004 00:11 Edited at: 17th Mar 2004 00:11
none that i know of...

DragnBreth
of
Dragael Software
John Y
Synergy Editor Developer
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: UK
Posted: 17th Mar 2004 14:51
That code is wrong anyway...arrays start at 0 and go to (50-1).

So it should be:

DIM array(50)

for n=0 to 49
array(n)=10
next n

Level Maker 3D: www.levelmaker3d.co.uk/levelmaker3D.asp
DarkBasic Professional Editor: www.levelmaker3d.co.uk/ide.asp
also: www.levelmaker3d.co.uk/KrazyKarts/ & www.DigitalOmega.Net
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 17th Mar 2004 16:27
wrong again, this is completely legal in darkbasic:

dim idiots(50)
for a=0 to 50
idiots(a)=10
next a

Quote: "
UPDATED

Amd 2800+ 1024mb pc3200 A7N8X - Deluxe Ati Radeon 9800PRO 256mb
"

Login to post a reply

Server time is: 2025-05-22 21:49:27
Your offset time is: 2025-05-22 21:49:27