Modulo

Modulo( value_1, value_2, ... )
Modulo( value_1, value_2, ... )
Modulo( value_1, value_2, ... )
Modulo( value_1, value_2, ... )
modulo( value_1, value_2, ... )
modulo value_1, value_2, ...
Modulo( value_1, value_2, ... )
Modulo( value_1, value_2, ... )

Description

The Modulo function computes the remainder after division on a list of numbers. Providing a single operand returns the operand.

Attempting to call modulo with an empty array results in the error "Non-empty array expected." Check to make sure at least one argument is passed to modulo function.

Attempting to compute the remainder of a division by zero results in the error "Illegal division by zero."

Parameters

Argument Type Definition and Requirements

value

List of Numbers

A single value or a list of values.

Returns

A number which is the modulo from the value list.

Examples

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "modulo": [ 10, 5, 2 ] }'
client.Query(Modulo(10, 5, 2));
System.out.println(
       client.query(Modulo(Value(10), Value(5), Value(2)))
       .get());
result, _ := client.Query(f.Modulo(10, 5, 2))

fmt.Println(result)
client.query(Modulo(10, 5, 2))
client.query(q.modulo(10, 5, 2))
$client.query do
  modulo 10, 5, 2
end
client.query(Modulo(10, 5, 2))
client.query(q.Modulo(10, 5, 2))
  .then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": 0 }

is equivalent to:

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "modulo": [ { "modulo": [ 10, 5 ] }, 2 ] }'
client.Query(Modulo(Modulo(10, 5), 2));
System.out.println(
       client.query(Modulo(Modulo(Value(10), Value(5)), Value(2)))
       .get());
result, _ := client.Query(f.Modulo(f.Modulo(10, 5), 2))

fmt.Println(result)
client.query(Modulo(Modulo(10, 5), 2))
client.query(q.modulo(q.modulo(10, 5), 2))
$client.query do
  modulo modulo(10, 5), 2
end
client.query(Modulo(Modulo(10, 5), 2))
client.query(q.Modulo(q.Modulo(10, 5), 2))
  .then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": 0 }

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!