Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex algpseudocode IF with multiple conditions [closed]

Tags:

latex

I'm trying to write a pseudo code with Latex in my paper where I need to put a IF condition which has multiple conditions. I'm trying this but doesnt 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'm using the algpseudocode package. Also I need to put a "space" within the conditions, but latex just discards it and connects the two words together, any way to do this?

Cheers,

like image 872
Tring Avatar asked Mar 18 '12 05:03

Tring


1 Answers

Nevermind guys, 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}
like image 86
Tring Avatar answered Nov 07 '22 02:11

Tring