<!-- 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; [add](./brick-next-pipes.add.md)

## add() function

数学加法或字符串拼接。

 Mathematics

**Signature:**

```typescript
export declare function add(value: number | string, operand: number | string): number | string;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  value | number \| string | 值。 |
|  operand | number \| string | 操作数。 |

**Returns:**

number \| string

如果其中一个参数为字符串，返回字符串，否则返回数字。

## Remarks

详见 [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition)<!-- -->。

## Example

数学加法：

```ts
// Number + Number -> addition
1 + 2 // 3

// Boolean + Number -> addition
true + 1 // 2

// Boolean + Boolean -> addition
false + false // 0
```

字符串拼接：

```ts
// String + String -> concatenation
'foo' + 'bar' // "foobar"

// Number + String -> concatenation
5 + 'foo' // "5foo"

// String + Boolean -> concatenation
'foo' + false // "foofalse"
```


