Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iteration through array

Status
Not open for further replies.

cruzer330

Programmer
Nov 29, 2000
12
US
I wonder if anyone has a faster solution to this. I have an array about 100 items. I want to do a calculation to each item and then I want to sum the items starting at the bottom. Is there a faster way to do this?

redim q (1 to 100)
redim x (1 to 100)
redim y (1 to 101)

a=1
b=100

for i = a to b
x(i) = 1 - q(i-1)
next i
y(101) = 0
for i = b to a step -1
y(i) = x(i) + y(i+1)
next i
 
redim q (0 to 100)
redim x (1 to 100)
redim y (1 to 101)

a=1
b=100

y(101) = 0

for i = b to a step -1
x(i) = 1 - q(i-1)
y(i) = x(i) + y(i+1)
next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top