Using variable values within other variables (Language Help)

by Lockjaw, Monday, June 04, 2012, 23:52 (1965 days ago)

I'm working on a program that needs to use the incremental value of a for to loop in another variable name, like this:

for ddi=1 to 10
dc(ddi)$=mid(string(wcheck),ddi,1)
dcsum=dcsum+int(dc(ddi)$)
next ddi

What I'm trying to do is take a ten-digit number (wcheck) and add the digits together to check against a checksum. Is there a way to make the value of ddi part of another variable (dc1$-dc10$)? Or is there an easier way of doing this rather than converting the number to a string, stripping the numbers with the mid statement, then converting them back to add them?

Thanks!


Complete thread:

 RSS Feed of thread

powered by my little forum