bool
bool
功能
把值按 BT 真值规则转换为布尔值。
语法
bool(value)
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| value | Any | 否 | 无 | 要转换的值。 |
返回值
| 类型 | 说明 |
|---|---|
| Bool | 返回转换后的布尔值。 |
示例
result = bool('BT') // 输出:true print result
注意事项
- Null、Empty、0、0.0、false、空字符串、空数组、空对象为 false。
把值按 BT 真值规则转换为布尔值。
bool(value)
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| value | Any | 否 | 无 | 要转换的值。 |
| 类型 | 说明 |
|---|---|
| Bool | 返回转换后的布尔值。 |
result = bool('BT') // 输出:true print result