javascript: declaring a variable in 'while' loop

i have a script called xmlReader, which does exactly what it says: read strings from an xml-file.
now i want to declare a variable for every string, but i’m stuck at how to do that exactly.
the code is the following:

import System.Xml;
import System.IO;
var xmlString : String;
var i : int = 0;

function Start()
{
var asset:TextAsset = Resources.Load("test 1");
  
	if(asset != null)
	{
	var reader : XmlTextReader = new XmlTextReader(new StringReader(asset.text));

	while(reader.Read())
	{
		if(reader.Name == "item")
		{
		Debug.Log(reader.Name + " label = " + reader.GetAttribute("label"));
		xmlString= reader.GetAttribute("label");
		Debug.Log(xmlString);
		i++;
		}
	}
    }
}

i declared xmlString as global var in the beginning for testing so i could see if anything gets written inside the loop.
i was hoping that i could use ‘i’ as an addition to every variable name, but i couldn’t find any syntax that worked with that. i tried things like

xmlString +i = reader.GetAttribute("label");

but it’s only producing an error.
so how can i dynamically declare variables in a loop?

A simple way would be to declare xmlString as an Array:

  var xmlString = new Array();

And use it as any array:

    xmlString *= reader.GetAttribute("label");*

The Array class is not the more efficient resource in the world, and should be avoided in Updates and other frequently called functions because it is a variant type: the system has a lot of behind-the-scene work to do (check content type, manage array size, etc.). But in your application it seems to be the best alternative, since you don’t know beforehand how many lines will be read.

You can’t. I think what you’re looking for is an array:

xmlString *= ...*

Be sure your array is large enough:
val xmlString = new String[100];