On Thursday 11 December 2008 08:28:40 am Zhichu Chen wrote:
Hi Bart,
On Thu, Dec 11, 2008 at 11:05 PM, Bart C. Wise
wrote: Chen,
Thanks. That makes sense now. However, when I take your code and run it, it only goes through 1 iteration of the loop and exits. I'm puzzled.
Bart
Really? 'cause when I run the following code =============================== \newcount\startcnt
\newcount\tempcnta
\def\myloop#1{% \message{enter} \tempcnta=\the\startcnt% \loop \message{loop} \advance \tempcnta by 1 \ifnum\tempcnta<#1 \repeat \message{exit}}
\starttext
\startcnt=1800
\myloop{2008}
\stoptext ===============================
I got
=============================== systems : begin file test2 at line 14 enter loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop loop exit systems : end file test2 at line 20 ) ===============================
which infers it works for me.
Anyway, I recommand you take the advanced interface as Hans has suggested. It's easier to use, makes more sense and is more ConTeXt-like.
Chen, Just to make sure I wasn't going too insane, I took your code and ran it. It worked. The difference is that in the previous email you sent, you had the code like this: \if\tempcnta<#1\repeat instead of this newer one: \ifnum\tempcnta<#1\repeat That's why it didn't work. Thanks to all! Bart