Number variables names in a loop

Hi,
Im using Gauss11 (so "ftos" is not an option) and I just want
to number variable names in a loop. The idea is the following:

k=1;kmax=7;

do until k==kmax;

string'k' = "Hello";

k=k+1;
endo;

So I end up with string1, string2, string3... all equaling "Hello".

I know it should be pretty much simple, but anyway. Help is highly appreciated.

Best regards, kurt

1 Answer



0



In most cases, it is much better to create an array of strings instead of a bunch of separate variables.

For example:

kmax = 7;
my_strings = reshape("Hello", kmax, 1);

then you can access them by index.

print my_strings[4];

aptech

1,773

Your Answer

1 Answer

0

In most cases, it is much better to create an array of strings instead of a bunch of separate variables.

For example:

kmax = 7;
my_strings = reshape("Hello", kmax, 1);

then you can access them by index.

print my_strings[4];


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.