I have a program in GW Basic to collect data, and it needs to be re-written as the data is increasing and would be best handled within a loop.

I read in range of string data; "A", "B", .... within the loop. I then need to input, from the keyboard, numerical data, say A1, A2, A3, A4 against each of these String variables.

Q. How do I convert string "A" into numerical variables A1, A2, ...? I cannot find anyway in GW Basic that allows this.

Thanks

Not sure what you mean by

convert string "A" into numerical variables A1, A2,

. If you're trying to associate the numeric input with the string variable, could be done with a table? If the string data is single character, then IIRC the VAL() function would return the ASCII value of the string. So the table(1,1) would be VAL(A$), table(1,2) would be A1...., table(2,1) would be VAL(B$), table(2,2) would be B1..... to the end of the loop.

FWIW. Been a few years since i did BASIC.

Thanks Ken.
I may have gotten around the problem myself by simply collecting the data in pre-defined arrays: A(), B() ..., which avoids the problem of trying to generate, on the run, new variable names for numbers from string characters.
But I will play with your ideas to see where I can go.
In the 'old' days (early 1980's), this problem was easily solved by poking the required characters into basic memory, but I feel less confident about that on a modern computer running XP.
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.