\documentclass{article} \usepackage{algorithmic} \begin{document} \begin{algorithmic}[1] \IF{first condition} \RETURN one \ELSIF{second condition} \RETURN two \ENDIF \STATE do something \STATE and another \IF{third condition} \FORALL{items} \STATE do some more \ENDFOR \RETURN three \ELSE \RETURN four \ENDIF \end{algorithmic} \end{document}