At a basic level TeX does not provide a for-loop construct, but allows tail-end recursion, however Knuth defined \loop in the plain macros. Coders have been coming with variations of their own ever since.
The ifthen package provides the whiledo loop and there is a forloop macro. TikZ provides similarly a foreach macro.
Is there a canonical way to write a forloop in LaTeX, TeX and friends. How would you write the following?
\def\triangle#1{{\def\bull{}%
\count1=0
\loop
\edef\bull{$\bullet$\bull}
\ifnum\count1<#1
\advance\count1 by 1
\centerline{\bull}
\vskip-7.7pt
\repeat
\vskip 7.7pt\relax}}
which will produce a triangle made of dots
*
* *
* * *
As typically found in programming texts, can you re-write it in a better way?
