Latex algpsecode IF with multiple states

I am trying to write pseudo code with Latex in my article where I need to put an IF condition that has multiple conditions. I am trying to do this, but it doesn't seem to work as the \ Or command is not recognized:

\begin{algorithmic}

\While{$condition$}
    \State $do-something$

    \If {$condition-1$ \Or $condition-2$ \Or $condition-3$}
        \State $break$
    \EndIf

\EndWhile
\end{algorithmic}

      

I am using the algpseudocode package. Also I need to put "space" in the conditions, but latex just throws it away and connects two words together, is there any way to do this?

Greetings,

+3


source to share


1 answer


The guys at Nevermind found out. This is the correct way



\begin{algorithmic}

\While{$condition$}
    \State $do-something$

    \If {$condition$ $1$ OR $condition$ $2$ OR $condition$ $3$}
        \State $break$
    \EndIf

\EndWhile
\end{algorithmic}

      

+4


source







All Articles