All

All( values )
All( values )
All( values )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.

Description

The All function tests the provided values and returns true if all of the items in values are true, otherwise it returns false.

When values is an empty Array or Set, All returns true, because values itself is set.

Parameters

Argument Type Definition and Requirements

values

Array or Set

A group of values to test for being true.

Returns

A boolean indicating whether all of the items in values are true.

Examples

The following query uses All multiple times to demonstrate how the function evaluates several groups of values:

System.out.println(
    client.query(
        Arr(
            All(Arr(Value(true), Value(true), Value(true))),
            All(Arr(Value(false), Value(true), Value(true))),
            All(Arr())
        )
    ).get());
client.query([
  q.All([true, true, true]),
  q.All([false, true, true]),
  q.All([]),
]).then((ret) => console.log(ret))
println(Await.result(
  client.query(
    Arr(
      All(Arr(true, true, true)),
      All(Arr(false, true, true)),
      All(Arr())
    )
  ),
  5.seconds
))
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
[true, false, true]
[ true, false, true ]
[true, false, true]

Was this article helpful?

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

Thank you for your feedback!