Difference between revisions of "Command/doloop"
< Command
Jump to navigation
Jump to search
m (looplevel --> recurselevel) |
|||
Line 3: | Line 3: | ||
|attributes= | |attributes= | ||
}} | }} | ||
+ | |||
+ | == [[Help:Reference|Syntax]] (autogenerated) == | ||
+ | <syntax>doloop</syntax> | ||
== [[Help:Reference|Syntax]] == | == [[Help:Reference|Syntax]] == |
Latest revision as of 16:22, 11 November 2019
\doloop
Syntax (autogenerated)
\doloop{...} | |
{...} | command |
Syntax
\doloop{commands} | |
{commands} | Commands or text to repeat |
Description
Repeat indefinitely; stop after a loop in which \exitloop is encountered, or immediately when \exitloopnow is encountered.
Example
\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
See also
- System Macros/Loops and Recursion
- Looping a fixed number of times
- \dorecurse for iterating from 1 to n.
- \dostepwiserecurse for iteration with arbitrary start, end, and step.
- \recurselevel for the iteration number.
- \recursedepth for the iteration depth, in the case of nested \dorecurse and co.
- 'While' loops with exit conditions
- \doloop for a loop that repeats until exited.
- \exitloop to exit a loop.
- \exitloopnow to immediately exit a loop.
- \recurselevel to know which iteration the loop is in.
- \recursedepth to know how many nested loops deep we are.
- \input is also often used to produce dummy text.
- LuaTeX for heavier-duty looping and iterating.
Help from ConTeXt-Mailinglist/Forum
All issues with: