Loop in Imacros using Javascript

for (i = 0; i < n; i++)
{
iimPlay("macroname.iim");
}

There is this option too.

var macro;

macro ="CODE:";
macro +="TAG POS=1 TYPE=DIV ATTR=CLASS:some_class"


var n=10;


for(var i=0;i<n;i++)
{
iimPlay(macro)
}

In codes above n is not defined so it will return an error.