> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognigy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# evaluateRule

<a href="/release-notes/2026.5"><Badge className="version-badge" color="blue">Updated in 2026.5</Badge></a>

## Syntax

`evaluateRule(rule)`

## Description

Evaluates a condition based on a rule configuration that follows the `left`, `operator`, `right` pattern. This function works similarly to the If Node. The `left` value is compared with the `right` value using the specified operator (for example, `!=`, `>`, `includes`). If the condition evaluates to `true`, the associated logic or transition is executed.

This function is asynchronous.

**Parameters:**

* `rule`: `IRule` – a rule configuration object.

<Accordion title="IRule Object Structure">
  ```js theme={null}
  export const ruleOperands = <const>[
      "lt",
      "lte",
      "eq",
      "neq",
      "gt",
      "gte",
      "exists",
      "nexists",
      "contains",
      "ncontains",
      "isyes",
      "isno"
  ];

  export type TRuleOperand = typeof ruleOperands[number];

  export interface IRule {
      left: string;
      operand: TRuleOperand;
      right: string;
  }
  ```

  **Returns:** `Promise<boolean>` – a promise that resolves to `true` if the rule condition is met, otherwise `false`.
</Accordion>

## Example

```js theme={null}
const rule: IRule = {
  left: "hello world",
  operand: "contains",
  right: "hello"
};

const result = await evaluateRule(rule);

console.log(result); // true
```
