\algo{Factorial}\algalias{calculate a~factorial}
\algin A~non-negative integer~$n$
-\:If $n\ge 1$:
+\:If $n\ge 1$: \cmt{Test if something}
\::Return $n$
\:Else:
\::Return $n \cdot \alg{Factorial}(n-1)$
% \algo{name of the algorithm}\algalias{a longer name}
% \algin input description
% \:step
-% \:step
+% \:step \cmt{comment}
% \::[identifier]nested step
% \:::yet more nested step
% \algout output description
\inititemize
\let\:=\algoitem
\def\={\leftarrow}
+ \let\cmt=\algcmt
\itemcount=0
}
% Algorithm name in text or in a formula
\protected\def\alg#1{\leavevmode\hbox{\csc #1}}
+
+% Comments
+\def\algcmt#1{\unskip~~\hfill\fullcmt{#1}\ignorespaces}
+\def\fullcmt#1{{$\triangleleft$\hskip0.5em\it #1}}