OR

OR returns true if any provided arguments return logical true, otherwise it returns false. Everything except FALSE is treated as true. It can also take an arbitrary number of additional arguments.

Function category: Logical

Syntax

OR(arg1, [arg2...])

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

Let's say we're given a response with the following fleet deployment information. However, the API returns no data for the fleet_3 element.

{
"data":{
"fleet_ready":{
"fleet_1":true,
"fleet_2":false,
"fleet_3":null
}
}
}

Example 1: Determine if any fleets are ready

If we want to determine whether ANY fleets are ready to deploy, use the following function.

# Any of the fleets ready
OR(data.fleet_ready.fleet_1, data.fleet_ready.fleet_2, data.fleet_ready.fleet_3)
# Returns true
# fleet_1 is ready

Example 2: Determine which combinations of fleets are ready

If we want to determine if either fleet_1 and fleet_2 are ready, use the following function.

# Determine if either of these fleets are ready
OR(data.fleet_ready.fleet_1, data.fleet_ready.fleet_2)
# Returns true
# fleet_1 is ready
# Determine if either of these fleets are ready
OR(data.fleet_ready.fleet_1, data.fleet_ready.fleet_3)
# Returns true
# fleet_1 is ready
# Determine if either of these fleets are ready
OR(data.fleet_ready.fleet_2, data.fleet_ready.fleet_3)
# Returns false
# Neither fleet is ready