Page 1 of 1

Automatically assign a value to a set of variables

Posted: 01 Aug 2015 07:59
by Giovanni
Greetings to all, this is my first message!
I apologize if I make a silly question ...

I need to automatically assign a value to variables:

for (i in [1 to 10])
{
var (i) = value (i);
}

How can I do?

Re: Automatically assign a value to a set of variables

Posted: 01 Aug 2015 10:58
by bogdyro
Do you need dynamically named variables? Like a1=1, a2=2, and so on?
for (i in [1 to 10])
{
eval('variableName'+"{i}"+'=i');
}

Re: Automatically assign a value to a set of variables

Posted: 01 Aug 2015 11:18
by Giovanni
Perfect, it was just what I wanted! Thank you.
I use automagic long enough but only for very simple tasks. Only recently I started to try the more advanced features.

I hope that you all want to help me to use more professionally Automagic.

Its author is a genius.