# AND (&&)
URL: https://docs.valsight.ai/and/
Description: Connects two inputs with the logical AND and returns true (1) if both values are true and false (0) otherwise.
**Category:** [Logical functions](/logical-functions/)

## Overview

The **AND** function **connects two inputs with the logical AND** and returns true (1) if both values are true and false (0) otherwise.

Use this function when you need a 1/0 flag that becomes true only if both inputs are true at the same time.

## Syntax

`AND('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 `AND` returns 1 only when both inputs are true at the same time. If either input is 0, the result is 0.

**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 | 12    |

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

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

## Related Functions

| Function          | When to use instead                                                                            |
| ----------------- | ---------------------------------------------------------------------------------------------- |
| [OR (\|\|)](/or/) | When at least one of the two inputs may be true instead of requiring both to be true.          |
| [XOR](/xor/)      | When exactly one of the two inputs should be true instead of requiring both inputs to be true. |
