5

I'm using Algorithm2e and want a loop with no intial condition and no ending condition. Using Algorithmic, this can be achieved with \Loop ... \EndLoop, but I cannot find a similar loop for Algorithm2e. How do I do this in Algorithm2e?

  • It's not very clear; can you make an example? – egreg Dec 4 '13 at 22:06
8

Something like this, with empty condition?

\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\thispagestyle{empty}

\SetKwFor{Loop}{Loop}{}{EndLoop}

\begin{algorithm}
  \Loop{}{Statement\;Statement\;}
\end{algorithm}
\end{document}

enter image description here

| improve this answer | |
  • 1
    Or perhaps more elegantly \SetKwBlock{Loop}{Loop}{EndLoop} – Detached Laconian Sep 6 '18 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.