Changes

Jump to navigation Jump to search
1,787 bytes added ,  09:46, 14 June 2012
m
Create entire page
{{Reference
|name=doloop
|attributes=
}}

== [[Help:Reference|Syntax]] ==
<table cellspacing="4" cellpadding="2" class="cmd">
<tr>
<td colspan="2" class="cmd">\doloop</td><!--
--><span class="second" >{''commands''}</span><!--
--></tr>
<tr valign="top" class="second">
<td class="cmd">{''commands''}</td>
<td>Commands or text to repeat</td>
</tr>
</table>

== Description ==

Repeat until {{cmd|exitloop}} is encountered.

== Example ==
<context source=yes>
\setuppapersize[A10, landscape][A8, landscape]
\setuppaper[nx=2, ny=2]
\setuppagenumbering[location=footer]
\setuparranging[XY]
\showframe[edge]

\starttext
\dorecurse{4}{
hello\crlf
\doloop{
\ifnum \pagenumber=\recurselevel
\exitloop
\fi
bla
}
\page[yes]
}
\stoptext
</context>

== See also ==
* [[System Macros/Loops and Recursion]]
* Looping a fixed number of times
** {{cmd|dorecurse}} for iterating from 1 to n.
** {{cmd|dostepwiserecurse}} for iteration with arbitrary start, end, and step.
** {{cmd|recurselevel}} for the iteration number.
** {{cmd|recursedepth}} for the iteration depth, in the case of nested {{cmd|dorecurse}} and co.
* 'While' loops with exit conditions
** {{cmd|doloop}} for a loop that repeats until exited.
** {{cmd|exitloop}} to exit a loop.
** {{cmd|exitloopnow}} to immediately exit a loop.
** {{cmd|recurselevel}} to know which iteration the loop is in.
** {{cmd|recursedepth}} to know how many nested loops deep we are.
* {{cmd|input}} is also often used to produce dummy text.
* [[Programming_in_LuaTeX#Loops_without_worrying_about_expansion|LuaTeX]] for heavier-duty looping and iterating.

== Help from ConTeXt-Mailinglist/Forum ==
All issues with:
{{Forum|{{SUBPAGENAME}}}}

[[Category:Command/Internals|doloop]]

Navigation menu