In the algorithmic
environment, I can use the \Comment
macro to put a comment after a statement. But when I try to put it before the first statement in an algorithm, I get an error. Is there a way to put a comment before a statement? e.g.:
// The following line initializes the variable x.
Let x = 0
Best Answer
Comments in pseudocode are typically set on the right, but you can use
\Statex
to set a blank (unnumbered)\State
and then insert whatever you like as a comment: