And: Logical AND

AndR Documentation

Logical AND

Description

Returns 1 if and only if all arguments equal 1, and 0 otherwise. For two operands, can also be written with the & operator: x & y.

Usage

And(..., id = NULL)

Arguments

...

Two or more boolean Variables or logic expressions.

id

Optional integer ID (internal use).

Value

An And expression.

See Also

Not(), Or(), Xor(), implies(), iff()

Examples

x <- Variable(boolean = TRUE)
y <- Variable(boolean = TRUE)
z <- Variable(boolean = TRUE)
both <- x & y            # operator syntax
both <- And(x, y)        # functional syntax
all3 <- And(x, y, z)     # n-ary

CVXR documentation built on Oct. 19, 2026, 5:07 p.m.