# OR (||)
URL: https://docs.valsight.ai/or/
Description: Returns 1 (true) if at least one of two inputs is true; otherwise returns 0 (false). Non-zero values are treated as true, while 0 is treated as false.
**Category:** [Logical functions](/logical-functions/)

## Overview

The **OR** function **connects two inputs with the logical OR** and returns true (1) if at least one of the values is true and false (0) otherwise.

Use this function when you need a 1/0 flag that becomes true as soon as at least one of two inputs is true.

## Syntax

`OR('Node1', 'Node2')`

`'Node1' || 'Node2'`

## Parameters

| Parameter | Description                                                                         | Type           | Required |
| --------- | ----------------------------------------------------------------------------------- | -------------- | -------- |
| **Node1** | First input node, specified using the node name in single quotes (e.g. `'Profit'`). | Node reference | Yes      |
| **Node2** | Second input node.                                                                  | Node reference | Yes      |

## Example

### Typical use

This example shows that `OR` returns 1 when at least one of the two inputs is true. Non-zero values are treated as true, while 0 is treated as false.

**Input node:** `'A'`

| Year | Value |
| ---- | ----- |
| 2025 | 17    |
| 2026 | 0     |
| 2027 | 0     |
| 2028 | 1     |

**Input node:** `'B'`

| Year | Value |
| ---- | ----- |
| 2025 | 1     |
| 2026 | 0     |
| 2027 | 1500  |
| 2028 | 0     |

**Formula:** `OR('A', 'B')`

| Year | OR Result |
| ---- | --------- |
| 2025 | 1         |
| 2026 | 0         |
| 2027 | 1         |
| 2028 | 1         |

## Related Functions

| Function          | When to use instead                                                                    |
| ----------------- | -------------------------------------------------------------------------------------- |
| [AND (&&)](/and/) | When both inputs must be true at the same time instead of just one of them.            |
| [XOR](/xor/)      | When exactly one of the two inputs should be true instead of allowing both to be true. |
