---
title: OR (latest version)
description: API reference for qiskit.circuit.library.OR in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.circuit.library.OR
---

# OR

*class* `qiskit.circuit.library.OR(num_variable_qubits, flags=None, mcx_mode='noancilla')`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/library/boolean_logic/quantum_or.py#L23-L106)

Bases: [`QuantumCircuit`](/docs/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")

A circuit implementing the logical OR operation on a number of qubits.

For the OR operation the state $|1\rangle$ is interpreted as `True`. The result qubit is flipped, if the state of any variable qubit is `True`. The OR is implemented using a multi-open-controlled X gate (i.e. flips if the state is $|0\rangle$) and applying an X gate on the result qubit. Using a list of flags, qubits can be skipped or negated.

The OR gate without special flags:

![Diagram illustrating the previously described circuit.](https://eu-de.quantum.cloud.ibm.com/docs/images/api/qiskit/qiskit-circuit-library-OR-1.avif)

Using flags we can negate qubits or skip them. For instance, if we have 5 qubits and want to return `True` if the first qubit is `False` or one of the last two are `True` we use the flags `[-1, 0, 0, 1, 1]`.

![Diagram illustrating the previously described circuit.](https://eu-de.quantum.cloud.ibm.com/docs/images/api/qiskit/qiskit-circuit-library-OR-2.avif)

> **Deprecated since version 2.1**
>
> The class `qiskit.circuit.library.boolean_logic.quantum_or.OR` is deprecated as of Qiskit 2.1. It will be removed in Qiskit 3.0. Use qiskit.circuit.library.OrGate instead.

**Parameters**

- **num\_variable\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The qubits of which the OR is computed. The result will be written into an additional result qubit.
- **flags** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*] | None*) – A list of +1/0/-1 marking negations or omissions of qubits.
- **mcx\_mode** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The mode to be used to implement the multi-controlled X gate.

## Attributes

### name

Type: `str`

A human-readable name for the circuit.

**Example**

```python
from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
```

```text
my_circuit
```
