<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [ternary](./brick-next-pipes.ternary.md)

## ternary() function

三元运算，根据条件返回两个值中的一个。

 Logic

**Signature:**

```typescript
export declare function ternary<T, U>(value: boolean, resultIfTrue: T, resultIfFalse: U): T | U;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  value | boolean | 条件。 |
|  resultIfTrue | T | 当条件为真时返回的值。 |
|  resultIfFalse | U | 当条件为假时返回的值。 |

**Returns:**

T \| U

当 `value` 为真时返回 `resultIfTrue`<!-- -->，否则返回 `resultIfFalse`<!-- -->。

