# Algorithms \And boolean operator casuing “Undefined Control Sequence” error

I'm writing some algorithms using the `algorithmicx` package.

I'm trying to create an `if` statement with an `And` boolean operator but using `\And` is causing an `Undefined Control Sequence` error

``````\usepackage{algorithm}
\usepackage{algpseudocode}

\If{\$i < j+bandSize\$ \And \$j < i+bandSize\$}
\State \$DTW_{i,j}\gets min(DTW_{i,j-1},DTW_{i-1,j},DTW_{i-1,j-1})+(f[i]-s[j])^2\$
\EndIf
``````

What's causing this?

-

I did not find any `\And` in `algpseudocode` or `algorithmicx`, but you can easily add one:
``````\algnewcommand\And{\textbf{and}}
Since `\And` is typically used as a parameterless macro almost like a binary relation in text, using `\algnewcommand{\And}{\textbf{and}\xspace}` seems a good idea (of course, including the `xspace` package). –  Werner Apr 5 '12 at 20:36