I want to write this in algorithm2e pseudocode:

Do N times
   stuff that has to be done N times

or maybe

Repeat N times
   stuff that has to be done N times

Since the loop body does not depend on a loop index, introducing one (like in a typical "for" loop) seems overkill.

My current best solution is

\For{$N$ times}{
  do stuff

but the output, "for N times do" is unclear.

(there are Do and Repeat commands in algorithm2e, but they both use end conditions: Do...while and Repeat...until, so not what I'm looking for.)

  • According to the docs there's \Repeat, so you should have a look at the package's documentation.
    – TeXnician
    Commented Jun 2, 2018 at 17:18
  • There is indeed Repeat, but that gives "repeat ... until condition"
    – Wouter
    Commented Jun 2, 2018 at 17:21

1 Answer 1


It seems there is no such built-in loop. Luckily, you can create your own! In algoritm2e, there are loops "with the condition at the start", or "with the condition at the end". To create your own "at the start" loop, do:


Then, to use it:


rendered latex image

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .