> For the complete documentation index, see [llms.txt](https://docs.taco.build/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taco.build/for-developers/conditions/logical-conditions/condition-set.md).

# CompoundCondition

`CompoundConditon` allow conditions to be combined into more complex logical statements. The logical operators allowed are `or`, `and`, and `not`.

## `or`/`and` operators

`or` & `and` operators require >= 2 operands to be specified.

Let's take a look at this abbreviated condition example:

```typescript
import { conditions } from '@nucypher/taco';

const conditionA = ...
const conditionB = ...

const aAndB = new conditions.compound.CompoundCondition({
  operator: 'and',
  operands: [conditionA, conditionB],
});
```

Here, we define two conditions `conditionA` and `conditionB`, and combine them into a single condition using `and` operator. So now, our new condition will "trigger" only when both `conditionA` *and* `conditionB` "trigger".

We can use two or more conditions when using `and` and `or` operators:

```typescript
const allMustPass = new conditions.compound.CompoundCondition({
  operator: 'and',
  operands: [conditionA, conditionB, ..., conditionX],
});

const anyOneMustPass = new conditions.compound.CompoundCondition({
  operator: 'or',
  operands: [conditionA, conditionB, ..., conditionX],
});

```

Alternatively, we can use `CompoundCondition.or` and `CompoundCondition.and` short-hand methods

```typescript
const allMustMatch = new conditions.compound.CompoundCondition.and([
    conditionA, conditionB, ..., conditionX],
]);

const atLeastOneMustMatch = new conditions.compound.CompoundCondition.or([
    conditionA, conditionB, ..., conditionX],
]);
```

## `not` operator

The `not` operator only allows one operand.

For example:

```typescript
import { conditions } from '@nucypher/taco';

const conditionA = ...

const notA = new conditions.compound.CompoundCondition({
  operator: 'not',
  operands: [conditionA],
});
```

## Nested Combinations

`CompoundCondition` objects can be nested on itself i.e. you can create compound conditions of compound conditions.

For example:

```typescript
import { conditions } from '@nucypher/taco';

const conditionA = ...
const conditionB = ...
const conditionC = ...
const conditionD = ...
const conditionE = ...

const cOrD = new conditions.compound.CompoundCondition({
  operator: 'or',
  operands: [conditionC, conditionD],
});

const notE = new conditions.compound.CompoundCondition({
  operator: 'not',
  operands: [conditionE],
});

// conditionA AND conditionB AND cOrD AND notE
overallCondition = new conditions.compound.CompoundCondition({
  operator: 'and',
  operands: [conditionA, conditionB, cOrD, notE],
});
```

{% hint style="info" %}
Individual conditions within the `CompoundCondition`can use different chain IDs as long as the chain IDs are supported by the `domain` network being used.
{% endhint %}

## Learn more

* [Broken mention](broken://pages/3qufTlyKsrLICoyVGk9J)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.taco.build/for-developers/conditions/logical-conditions/condition-set.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
