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
}
}

Because of your curly braces, this is your entire alias. You close the brackets here. The rest of the code you showed is doing nothing but taking up space confusing mirc.

Let's take a quick look at your while loop.

var %i = 1

while 1 is less than or equal to 10.
while (1 <= 10) {

if (%i = 1) echo -a 1
%i isn't 2 -10 so it compares false and gets to the inc.

Now %i = 2 which is less than or equal to 10.
%i = 2 so echo -a 2. Other comparisons are false so it incs %i.

Now %i is 3 which is less than or equal to 10.

It does this until the while comparison (%i <= 10) is false. Then it moves on past the while loop, but you have ended the alias with the closing curly brace so it stops.


How can it be shorter?

Well all you are doing is echoing what the variable is...

Code:
var %i = 1
while (%i <= 10) {
echo -a %i
inc %i
}