has_env
has_env
功能
判断用户全局环境中是否存在指定变量。
语法
has_env(name)
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| name | String | 否 | '' | 要检查的用户全局变量名。 |
返回值
| 类型 | 说明 |
|---|---|
| Bool | 用户全局变量存在返回 true,否则返回 false。 |
示例
name = 'BT' result = has_env('name') // 输出:true print result
注意事项
- 只检查全局变量表。
判断用户全局环境中是否存在指定变量。
has_env(name)
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| name | String | 否 | '' | 要检查的用户全局变量名。 |
| 类型 | 说明 |
|---|---|
| Bool | 用户全局变量存在返回 true,否则返回 false。 |
name = 'BT' result = has_env('name') // 输出:true print result