Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 963 Bytes

and.md

File metadata and controls

46 lines (36 loc) · 963 Bytes
layout language permalink command io related_commands
api-command
JavaScript
api/javascript/and/
and
bool
bool
or eq ne
or/
eq/
ne/

Command syntax

{% apibody %} bool.and([bool, bool, ...]) → bool r.and([bool, bool, ...]) → bool {% endapibody %}

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)).

Calling and with zero arguments will return true.

Example: Return whether both a and b evaluate to true.

var a = true, b = false;
r.expr(a).and(b).run(conn, callback);
// result passed to callback
false

Example: Return whether all of x, y and z evaluate to true.

var x = true, y = true, z = true;
r.and(x, y, z).run(conn, callback);
// result passed to callback
true