# Is it possible to use a number from a variable in a text file?

**URL:** <https://forum.kirupa.com/t/is-it-possible-to-use-a-number-from-a-variable-in-a-text-file/177206>\
**Category:** Uncategorized\
**Created:** [January 31, 2006, 1:24am UTC](https://forum.kirupa.com/t/is-it-possible-to-use-a-number-from-a-variable-in-a-text-file/177206 "2006-01-31T01:24:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandao](https://avatars.discourse-cdn.com/v4/letter/b/5fc32e/32.png) [@brandao](https://forum.kirupa.com/u/brandao)\
**Post date:** [January 31, 2006, 1:24am UTC](https://forum.kirupa.com/t/is-it-possible-to-use-a-number-from-a-variable-in-a-text-file/177206/1 "2006-01-31T01:24:18Z")

</div>

Hey guys I’ve got a question over something that should be simple but it’s doin my head in cause It doesnt work!

I got a “for in” loop loading variables from a textfile, I want to get from it the number of items to display.

in the text file the variable “sectionitems” corresponds to a string, “8”.

–\> &sectionitems=2

but this doesnt work:

for(i=0;i\<=sectionitems;i++) {

If I do that doesnt work as well, it makes as infinite loop

Number(sectionitems);

```auto

loadItems = new LoadVars();
loadItems.load("test.txt");
loadItems.onLoad = function() {
	nitems = this.sectionitems;
	test_tf.text = nitems;
	trace("nitems = " + nitems);
	for(i=0;i<=nitems;i++) {
		trace(i);
	}
}

```

this still makes an infinite loop !

how is it possible to use a number from a variable in a text file ?
