Difference between revisions of "Command/dorecurse"

From Wiki
Jump to navigation Jump to search
(Create dorecurse page)
 
 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>dorecurse</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
   <tr>
 
   <tr>
     <td colspan="2" class="cmd">\dorecurse
+
     <td colspan="2" class="cmd">\dorecurse<!--
      <span class="first" >{''n''}</span>
+
  --><span class="first" >{''n''}</span><!--
      <span class="second" >{''commands''}</span>
+
  --><span class="second" >{''commands''}</span><!--
    </td>
+
--></td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="first">
 
   <tr valign="top" class="first">
Line 21: Line 24:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
 
  
 
== Description ==  
 
== Description ==  
  
Repeat a command a number of times.
+
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]]
* [[Programming_in_LuaTeX#Loops_without_worrying_about_expansion LuaTeX]] for heavier-duty looping and iterating.
+
* 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.
 +
* {{cmd|definecounter}} to define custom numeric counters.
  
 
== Help from ConTeXt-Mailinglist/Forum ==
 
== Help from ConTeXt-Mailinglist/Forum ==

Latest revision as of 16:22, 11 November 2019

\dorecurse

Syntax (autogenerated)

\dorecurse{...}{...}
{...}number
{...}command


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

Help from ConTeXt-Mailinglist/Forum

All issues with: