When I run the code below (via minimals), I get the following error, why?

enter loop

! Extra \else.

\@@plniterate ...\expandafter \@@plniterate \else

\fi

\myloop ...by 1 \ifnum \tempcnta >#1\else \repeat

\fi \message {exit}

l.16 \myloop{2008}

Code:

\newcount\startcnt

\newcount\tempcnta

\def\myloop#1{%

\message{enter}

\tempcnta=\the\startcnt%

\loop

\message{loop}

\advance \tempcnta by 1

\ifnum\tempcnta>#1\else \repeat\fi

\message{exit}

}

\starttext

\startcnt=1800

\myloop{2008}

\stoptext

Thanks,

Bart