W3cubDocs

/RethinkDB Python

ReQL command: &, and_

Command syntax

bool & bool → bool
bool.and_([bool, bool, ...]) → bool
r.and_([bool, bool, ...]) → bool

Description

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

Related commands

Get more help

Couldn't find what you were looking for?

© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/python/and/