> For the complete documentation index, see [llms.txt](https://racoon-js.gitbook.io/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://racoon-js.gitbook.io/zh/jie-kou-shuo-ming/boolean/default.md).

# default

default(value, \[ctx])

## 作用

设置当被检测值为`undefined | null`时，`validate`和`validateSilent`方法的返回返回值。

## 参数

* `value` ***(\*)***  - *`validate`*&#x548C;*`validateSilent`*&#x9ED8;认返回值。推荐但不必须为`boolean`类型。当`value`为函数时，则设置函数的返回值为默认值，函数有一个参数：被检测原始值——`undefined`或`null`。
* `[ctx]` ***(\*)*** - 当`value`为函数时的执行上下文`this`。

## 示例

```javascript
const schema = racoon.boolean().default(false);
schema.validate(undefined); // pass, 返回 false
schema.validate(null); // pass, 返回 false
```
