Hi
Is possible to create a variable with a random number in name?
Something like:
xxx = random(100, 999);
global_variable_xxx = value;
Thanks
Variable with random name
Moderator: Martin
Re: Variable with random name
Hi,
You can use function setValue to achieve this.
For example:
However I would recommend not to use this mechanism but insterad use a map to store random values:
The advatage is that you only have one global variable that groups all your values.
Regards,
Martin
You can use function setValue to achieve this.
For example:
Code: Select all
setValue("global_variable_"+random(1, 100), value);
Code: Select all
global_map_with_random_values = newMap();
addMapEntry(global_map_with_random_values, "key_"+random(1, 100), value);
value = getMapValue(global_map_with_random_values, "key_"+random(1, 100));
Regards,
Martin