UiPath循环活动Do While的介绍和使用
一、Do While的介绍
先执行循环体, 再判断条件是否满足, 如果满足, 则再次执行循环体, 直到判断条件不满足, 则跳出循环
二、Do While在UiPath中的使用
1. 打开设计器,在设计库中新建一个Flowchart
![](https://upload-images.jianshu.io/upload_images/14843435-3731f42e4e092778.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
2.为Flowchart命名并设置存储路径
![](https://upload-images.jianshu.io/upload_images/14843435-5066830fd97bad09.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
3.在Activities中搜索Assign,添加两个Assign控件到设计区
![](https://upload-images.jianshu.io/upload_images/14843435-2d3f774b221baa53.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
4.为两个Assign设置变量、变量数据类型
![](https://upload-images.jianshu.io/upload_images/14843435-cc8477e6287aa6f5.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
5. 在Activities中搜索While,并将Do While控件拖至设计区
![](https://upload-images.jianshu.io/upload_images/14843435-ad44562de7c60cdc.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
6. 在Do While控件的Body中添加LogMessage用来打印num的值
![](https://upload-images.jianshu.io/upload_images/14843435-25360ff93bbe2839.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
7. 在DoWhile控件的Body中添加Assign控件,填写num变量每次循环+1的表达式,并在Do
While控件中的Condition填写判断表达式
注:While循环是限制性判断,然后再执行Body的表达式,而Do While循环则是先执行Body的表达式然后再判断
![](https://upload-images.jianshu.io/upload_images/14843435-91dc74aaa09e1557.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
8. 点击运行,在Output中查看运行结果
![](https://upload-images.jianshu.io/upload_images/14843435-82a66b4dfd02e9cb.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
UiPath交流群:465630324