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

# evaluateRule

[Updated in 2026.5](https://docs-classic.cognigy.com/release-notes/2026.5.md)

## 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] 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`.

## Example

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

const result = await evaluateRule(rule);

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.