layout | language | permalink | command | related_commands | ||||||
---|---|---|---|---|---|---|---|---|---|---|
api-command |
Python |
api/python/and/ |
&, and_ |
|
{% apibody %} bool & bool → bool bool.and_([bool, bool, ...]) → bool r.and_([bool, bool, ...]) → bool {% endapibody %}
Compute the logical "and" of one or more values.
The and_
command can be used as an infix operator after its first argument (r.expr(True).and_(False)
) or given all of its arguments as parameters (r.and_(True, False)
). The standard Python and operator, &
, may also be used with ReQL.
Calling and_
with zero arguments will return True
.
Example: Return whether both a
and b
evaluate to true.
> a = True
> b = False
> (r.expr(a) & b).run(conn)
False
Example: Return whether all of x
, y
and z
evaluate to true.
> x = True
> y = True
> z = True
> r.and_(x, y, z).run(conn)
True