I created this while loop but for some reason it fails, it echo's all lines under it.

I thought this is the way to do a while loop?

alias imaptest {
var %i = 1
while (%i <= 10) {
if %i = 1 /echo -a 1
if %i = 2 /echo -a 2
if %i = 3 /echo -a 3
if %i = 4 /echo -a 4
if %i = 5 /echo -a 5
if %i = 6 /echo -a 6
if %i = 7 /echo -a 7
if %i = 8 /echo -a 8
if %i = 9 /echo -a 9
if %i = 10 /echo -a 10
inc %i
}
}

:update:
if ( %i == $null ) {
set %i 1
}
echo -a %i
if (%i <= 10) {
{
if %i == 1 /echo -a 1
if %i == 2 /echo -a 2
if %i == 3 /echo -a 3
if %i == 4 /echo -a 4
if %i == 5 /echo -a 5
if %i == 6 /echo -a 6
if %i == 7 /echo -a 7
if %i == 8 /echo -a 8
if %i == 9 /echo -a 9
if %i == 10 /echo -a 10
}
inc %i
if ( %i == 11 ) {
set %i 1
}
}
}

I changed to above but imo it can be much shorter?
At least it works now

Last edited by ots654685; 05/04/09 11:43 AM.