\Header{Logic}{Logical Operators}
\alias{"!}{Logic}
\alias{\&}{Logic}
\alias{\&\&}{Logic}
\alias{xor}{Logic}
\alias{"|}{Logic}
\alias{"|"|}{Logic}
\keyword{logic}{Logic}
\begin{Description}\relax
These operators act on logical vectors.\end{Description}
\begin{Usage}
\begin{verbatim}
! x
x & y
x && y
x | y
x || y
xor(x, y)
\end{verbatim}
\end{Usage}
\begin{Details}\relax
\code{!} indicates logical negation (NOT).

\code{\&} and \code{\&\&} indicate logical AND and \code{|} and \code{||}
indicate logical OR.  The shorter form performs elementwise
comparisons in much the same way as arithmetic operators.  The longer
form evaluates left to right examining only the first element of each
vector.  Evaluation proceeds only until the result is determined.  The
longer form is appropriate for programming control-flow.

\code{xor} indicates elementwise exclusive OR.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{TRUE}} or \code{\Link{logical}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
y <- 1 + (x <- rpois(50, lambda=1.5) / 4 - 1)
x[(x > 0) & (x < 1)]    # all x values between 0 and 1
if (any(x == 0) || any(y == 0)) "zero encountered"
\end{ExampleCode}
\end{Examples}

