简介
Continue 组件类似于 Break 组件,搭配 For Each 和 While 组件使用。Continue 的作用是跳出当前循环,执行下一次循环。
操作配置
参数配置
无
输出
组件输出的 message 信息如下:
message 属性 | 值 |
payload | 在 For Each 组件中,Continue 跳出当前循环后,payload 的值为下一次循环遍历的数据。在 Whlie 组件中,Continue 跳出循环后,payload 继承自 Continue 的上一个组件输出的 payload。 |
error | 无。 |
attribute | 在 For Each 组件中使用时,Continue 跳出循环后,attribute 继承自 For Each 的上一个组件输出的 attribute;在 While 组件中使用时,Continue 跳出循环后,attribute 继承自 While 的上一个组件输出的 attribute。 |
variable | 在 For Each 中使用时,Continue 跳出循环后,variable 中的变量继承自 Continue 的上一个组件输出的 variable 变量;在 While 组件中使用时,variable 中的变量继承自 Continue 的上一个组件输出的 variable 变量。 |
案例
在本案例中,我们使用 For Each 对列表中的奇数求和,遇到偶数,则使用 Continue 跳出当次循环。
1. 添加 For Each 组件,填入要遍历的集合[1,2,3,4,5]。
![image-20210330141940166](https://qcloudimg.tencent-cloud.cn/image/document/1336b7ff45bb3cca94498f0e906a62de.png)
![image-20210330141940166](https://qcloudimg.tencent-cloud.cn/image/document/1336b7ff45bb3cca94498f0e906a62de.png)
![image-20210330142019571](https://qcloudimg.tencent-cloud.cn/image/document/fbc602336f2a0f83008e834a333282aa.png)
![image-20210330142019571](https://qcloudimg.tencent-cloud.cn/image/document/fbc602336f2a0f83008e834a333282aa.png)
2. 添加 Choice 组件,在 When 节点中对数据进行筛选。
![image-20210330143531318](https://qcloudimg.tencent-cloud.cn/image/document/b8a13d2310c4fe4986ee1d9d73fe7643.png)
![image-20210330143531318](https://qcloudimg.tencent-cloud.cn/image/document/b8a13d2310c4fe4986ee1d9d73fe7643.png)
![image-20210330143502312](https://qcloudimg.tencent-cloud.cn/image/document/8ab9b375ed0690e05353c736f94c497b.png)
![image-20210330143502312](https://qcloudimg.tencent-cloud.cn/image/document/8ab9b375ed0690e05353c736f94c497b.png)
3. 在 When 节点中加入 Continue 节点。
![image-20210330143642462](https://qcloudimg.tencent-cloud.cn/image/document/331a12376f7dc042416c411458df4bab.png)
![image-20210330143642462](https://qcloudimg.tencent-cloud.cn/image/document/331a12376f7dc042416c411458df4bab.png)