# Variable in for loop definition, is it possible?

**URL:** <https://forum.kirupa.com/t/variable-in-for-loop-definition-is-it-possible/106351>\
**Category:** Uncategorized\
**Created:** [April 4, 2004, 11:48pm UTC](https://forum.kirupa.com/t/variable-in-for-loop-definition-is-it-possible/106351 "2004-04-04T23:48:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jugglerpm](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@jugglerpm](https://forum.kirupa.com/u/jugglerpm)\
**Post date:** [April 4, 2004, 11:48pm UTC](https://forum.kirupa.com/t/variable-in-for-loop-definition-is-it-possible/106351/1 "2004-04-04T23:48:20Z")

</div>

I’d love to be able to use a variable to define the variable in a for loop. Surely, it’s possible? Here’s the basic syntax I’m trying:

```auto
	var r = q + 1;
		for (var i=r; i<8; i++){} {

```

Notice I’m trying to set i equal to r.

Do I need brackets, quotes, some other fancy formating?

Thanks,

-pm
