[Tex/LaTex] Infinite loop with Algorithm2e

algorithm2epseudocode

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?

Best Answer

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