Difference between revisions of "Command/dorecurse"
< Command
Jump to navigation
Jump to search
m (typo!) |
(More elaborate See Also) |
||
Line 21: | Line 21: | ||
</tr> | </tr> | ||
</table> | </table> | ||
− | |||
== Description == | == Description == | ||
− | Repeat | + | Repeat something a number of times. |
== Example == | == Example == | ||
<context source=yes> | <context source=yes> | ||
− | \dorecurse{3}{Meow... | + | \dorecurse{3}{Meow\low{\recurselevel}... } |
</context> | </context> | ||
== See also == | == See also == | ||
− | * {{cmd|input}} is also often used to produce dummy text | + | * [[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|looplevel}} to know which iteration the loop is in. | ||
+ | ** {{cmd|loopdepth}} 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. | * [[Programming_in_LuaTeX#Loops_without_worrying_about_expansion|LuaTeX]] for heavier-duty looping and iterating. | ||
Revision as of 08:46, 14 June 2012
\dorecurse
Syntax
\dorecurse{n}{commands} | |
{n} | The number of times to repeat the commands |
{commands} | Commands or text to repeat |
Description
Repeat something a number of times.
Example
\dorecurse{3}{Meow\low{\recurselevel}... }
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.
- \looplevel to know which iteration the loop is in.
- \loopdepth 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: