create multiple variables in loop
Posted: Wed Feb 22, 2017 8:06 pm
hello
I'm trying to create multiple variable in a loop, assign values to the created variables, then use the created variables and assigned values in new calculations outside of the loop. I'm getting zero's for f,g,and h. How can I make this work? thanks
a=50
b=5
FOR i=1 TO 5
x$="FL"
y$=y$+1
z$=x$&y$ 'concatenate to give FL1, FL2 and so on
PRINT z$
z$=a+b 'assign calculated value "a+b" to each FL1,FL2 and so on
PRINT z$
NEXT i
'use created FL1,FL2 and so on, and assigned values in new calculations
f=FL1+FL2
g=FL5-FL3
h=FL4*FL1
PRINT f
PRINT g
PRINT h
I'm trying to create multiple variable in a loop, assign values to the created variables, then use the created variables and assigned values in new calculations outside of the loop. I'm getting zero's for f,g,and h. How can I make this work? thanks
a=50
b=5
FOR i=1 TO 5
x$="FL"
y$=y$+1
z$=x$&y$ 'concatenate to give FL1, FL2 and so on
PRINT z$
z$=a+b 'assign calculated value "a+b" to each FL1,FL2 and so on
PRINT z$
NEXT i
'use created FL1,FL2 and so on, and assigned values in new calculations
f=FL1+FL2
g=FL5-FL3
h=FL4*FL1
PRINT f
PRINT g
PRINT h