> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 设置变量（1.x版本）

## 指令说明

**描述：** 新建一个变量并赋值，或者对已有的变量赋值

## 参数说明

<Tabs>
  <Tab title="常规">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-01.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=2d9087d12d0024538f338e6c7301373b" alt="设置变量（1.x版本）指令参数面板" width="813" height="586" data-path="helpcenter/commands/data-processing/images/setvariablecommand-01.png" />

    <img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-07.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=a76cb0d6115a6d9b9273d098278d6067" alt="设置变量（1.x版本）指令参数面板" width="658" height="317" data-path="helpcenter/commands/data-processing/images/setvariablecommand-07.png" />

    | 参数          | 说明                               |
    | ----------- | -------------------------------- |
    | **变量类型**    | 变量的类型可以选择为：数值、布尔值或字符串            |
    | **变量值**     | 直接输入变量的值，或选择已有的变量给它赋值            |
    | **生成的变量名称** | 可以新建一个名字作为变量的的名字，也可以选择已有的变量，给它赋值 |
  </Tab>

  <Tab title="高级" />
</Tabs>

## 使用示例

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-03.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=d5d04be22cea34e74a6bd4ade05ea931" alt="设置变量（1.x版本）使用示例" width="654" height="469" data-path="helpcenter/commands/data-processing/images/setvariablecommand-03.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-02.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=d3bdd614a69855f6262e5ef1b3e7a039" alt="设置变量（1.x版本）使用示例" width="655" height="473" data-path="helpcenter/commands/data-processing/images/setvariablecommand-02.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-08.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=7bb02243387bea42ed9bf8a0c990f979" alt="设置变量（1.x版本）使用示例" width="1356" height="213" data-path="helpcenter/commands/data-processing/images/setvariablecommand-08.png" />

**该流程执行逻辑：**

本例演示【设置变量（1.x版本）】指令的配置与执行：

1. 使用【新建变量】创建数值变量“序号”，初始值设为 `1`。
2. 执行【设置变量】，选择“序号”，将值设置为“序号 + 1”。输入加号后需选择运算符，才能执行数值运算。
3. 使用【打印日志】输出“序号”，结果为 `2`；把步骤 2 放入循环后，可在每次循环中让序号递增。

完整循环示例：[打开应用示例](https://rpa.bazhuayu.com/shareableLink/659fb8a45d1eb11125dd25a9)

### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-04.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=dd7d489149cc37d22f537204a8ac40c3" alt="设置变量（1.x版本）效果展示" width="1392" height="795" data-path="helpcenter/commands/data-processing/images/setvariablecommand-04.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-05.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=41f0ffdc114c6184c493c789e8bab7d3" alt="设置变量（1.x版本）效果展示" width="647" height="163" data-path="helpcenter/commands/data-processing/images/setvariablecommand-05.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-06.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=f5e3b05867dc44d27f1af953616cdcb1" alt="设置变量（1.x版本）效果展示" width="1400" height="800" data-path="helpcenter/commands/data-processing/images/setvariablecommand-06.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/setvariablecommand-09.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=733229f9c301dfdf894ec6f85eecb31e" alt="设置变量（1.x版本）效果展示" width="1347" height="183" data-path="helpcenter/commands/data-processing/images/setvariablecommand-09.png" />

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
