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.

Newcomers DBPro Corner / Need Help Using Arrays

Author
Message
dhballer1
20
Years of Service
User Offline
Joined: 19th Oct 2003
Location: MA
Posted: 29th Oct 2003 01:03
This might sound a little stupid and it might also make me look stupid but I'm a beginner.

Dim A(4)
A(1) = 4
A(2) = 4
A(3) = 4
A(4) = 4
For T = 1 To 4
Print A(T)
Next T

I want it that when it prints, instead of printing 4 four times in a row it multiplies A(1) * A(2) * A(3) * A(4) and i don't want to add another variable that sais B = A(1) * A(2) * A(3) * A(4) and then print B. I want to probably do it using a loop or something because If it was very long like A(100) it would take a long time to write B = A(1) * A(2)...

Thank you
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Oct 2003 01:31
Like this?

skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 29th Oct 2003 01:32
do you mean

len = 100
dim a(len)

....
tmp = a(0)
for i=2 to len
tmp = tmp * a(i)
next i

print tmp

thats what i have understood
dhballer1
20
Years of Service
User Offline
Joined: 19th Oct 2003
Location: MA
Posted: 29th Oct 2003 01:47
Ok, thank you.
Sorry for confusing you skovron. Maybe my typing was not too clear. Thanks again.

Login to post a reply

Server time is: 2024-09-21 07:40:54
Your offset time is: 2024-09-21 07:40:54