# algorithm2e - Different ending words for switch and case blocks

In the following MWE, I would like the end of switch to be different from the ends of case and other. Is it possible ?

\documentclass{article}
\usepackage{algorithm2e}

\begin{document}

\begin{algorithm}
\Begin{
\Switch{X}{
\Case{1}{
\While{Continue}{Action}
}
\Other{Other}
}
}
\end{algorithm}

\end{document}

-

It appears to be easier to change it for Case than Otherwise, but this seems to work:

\documentclass{article}
\usepackage[longend]{algorithm2e}
\makeatletter

\SetKwFor{Case}{case}{}{end case}%

\renewcommand\algocf@Other[1]{%
\KwSty {otherwise}\algocf@block {#1}{\@algocf@endoption {end other}}}

\makeatother

\begin{document}

\begin{algorithm}
\Begin{
\Switch{X}{
\Case{1}{
\While{Continue}{Action}
}
\Other{Other}
}
}
\end{algorithm}

\end{document}

-
Thanks for this trick ! –  projetmbc Oct 28 '12 at 10:29