AND

AND returns true if the provided arguments all return logical true, otherwise it returns false. Everything except false is treated as true.

Function category: Logical

Syntax

AND(arg1, [arg2...])

Parameters

AND can take an arbitrary number of additional arguments.

Arguments

Description

arg1

Expression that can be interpreted as true or false (including numbers, strings, and arrays etc.).

arg2

Optional. Same restrictions as arg1.

Examples

Example 1: Completed deployment

Let's say we're given a response with some fleet deployment information that looks like this:

{
"company_a":{
"deployments":{
"fleet_1":true,
"fleet_2":true,
"fleet_3":true
}
}
}

And another set of deployment information from an API that returns 1 as true, and where there was no data returned for the fleet_2 element:

{
"company_b":{
"deployments":{
"fleet_1":1,
"fleet_2":null
}
}
}

If we want to determine that all deployments are completed, we would use the following function:

AND(company_a.deployments.fleet_1, company_a.deployments.fleet_2, company_a.deployments.fleet_3)

This returns the following:

true

Example 2: "Truthy" results

We can also interpolate different kinds of "truthy" results.

The following function returns logical true:

AND(company_a.deployments.fleet_1, company_b.deployments.fleet_1)

This results in the following:

true

The following function returns logical false:

AND(company_a.deployments.fleet_1, company_b.deployments.fleet_2)

This results in the following:

false