Difference between revisions of "Command/dostepwiserecurse"

From Wiki
Jump to navigation Jump to search
(Create entire page)
 
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>dostepwiserecurse</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
Line 60: Line 63:
 
** {{cmd|exitloop}} to exit a loop.
 
** {{cmd|exitloop}} to exit a loop.
 
** {{cmd|exitloopnow}} to immediately exit a loop.
 
** {{cmd|exitloopnow}} to immediately exit a loop.
** {{cmd|looplevel}} to know which iteration the loop is in.
+
** {{cmd|recurselevel}} to know which iteration the loop is in.
** {{cmd|loopdepth}} to know how many nested loops deep we are.
+
** {{cmd|recursedepth}} to know how many nested loops deep we are.
 
* {{cmd|input}} is also often used to produce dummy text.
 
* {{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.

Latest revision as of 16:22, 11 November 2019

\dostepwiserecurse

Syntax (autogenerated)

\dostepwiserecurse{...}{...}{...}{...}
{...}number
{...}number
{...}[+-]number
{...}command


Syntax

\dostepwiserecurse{start}{stop}{step}{commands}
{start} Initial value of recurselevel
{stop} Stop when recurselevel is higher than this (or when lower, if step is negative)
{step} Increment recurselevel by this much after each iteration
{commands} Commands or text to repeat

Description

Repeat something for start, start + step, start + 2*step, ..., continuing until stop is exceeded.

Example

Counting down:
\dostepwiserecurse{10}{4}{-2}
    {\recurselevel...\ }
Counting stopped.

Counting down again:
\dostepwiserecurse{10}{5}{-2}
    {\recurselevel...\ }
Counting stopped.

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: