# Algorithmic package for loop and comment at the same line

I want to have the following output using algorithmic package:

for i = 1 : z do // number of rows
x = 1
end for


I use the following tex code:

\begin{algorithmic}
\FOR{$p=1:r$} // number of rows
\STATE $x=1$
\ENDFOR
\end{algorithmic}


It doesn't work. I couldn't find any way to put the comments to the same line with for. Is there any way to do that with the algorithmic package?

# EDIT

## 1.

Code:

\FOR[// loop over all puppies]{$p=1:r$}
\STATE $x=1$
\ENDFOR


Result:

for i = 1 : z do {// number of rows}
x = 1
end for


## 2.

Code:

\FOR{$p=1:r$ \COMMENT{// number of rows}}
\STATE $x=1$
\ENDFOR


Result:

for i = 1 : z {// number of rows} do
x = 1
end for


Is there any way to get rid of these curly brackets?

-
@Caramdir: I use algorithm and algorithmic packages. –  celebisait Jul 1 '12 at 17:25
@Caramdir: I edited the original post. –  celebisait Jul 1 '12 at 17:34

the package defines

  \newcommand{\algorithmiccomment}[1]{\{#1\}}


so if you go

\renewcommand{\algorithmiccomment}[1]{#1}


the braces will be gone.

-