The example for the code is from the manual (v.4.01).
Following the example at Latex-algorithmic-if-else.png, this was produced by the following:
$ cat algorithm2e.tex
\documentclass[12pt]{article}
\usepackage[lined,boxed,commentsnumbered]{algorithm2e}
\usepackage[right=5cm]{geometry}
\usepackage[active,pdftex,tightpage]{preview}
\PreviewEnvironment[]{algorithm}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined % new in release 4.01 (Dec 2009); doesn't work in release 3.9 (Oct 2005)
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{document}
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.