On Thursday 11 December 2008 07:05:05 am Zhichu Chen wrote:
> Hi Bart
>
> On Thu, Dec 11, 2008 at 9:50 PM, Bart C. Wise
>
> <[EMAIL PROTECTED]> wrote:
> > 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
>
> I think the loop structure should be:
> \loop ... \if...  ... \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
> >

Zhichu,

If I change the loop to be the following, I still get the same error:

\def\myloop#1{%
  \tempcnta=\the\startcnt%
  \loop
    \advance \tempcnta by 1
    \if\tempcnta=#1\else \repeat\fi
}

Bart
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to