当前位置:网站首页>【UiPath2022+C#】UiPath 练习和解决方案-变量、数据类型和控制流程
【UiPath2022+C#】UiPath 练习和解决方案-变量、数据类型和控制流程
2022-08-05 05:17:00 【会敲键盘的肘子】
【UiPath2022+C#】UiPath 练习-变量、数据类型和控制流程
文章目录
环境
UiPath Studio Community 2022.4.3
Windows
C#
练习
练习 1 - 遍历循环和 If 语句
查找数组中的最小数和最大数
使用“遍历循环”、“分配”和“If 语句”查找 Int32 元素数组中的最小数和最大数,然后打印结果。
注意:您可以使用 {7, 5, 2, 4, 3, 9} 或自定义值(只要是整数)实例化数组。
解决方案
C#解决方案
创建一个静态类
public static class MaxMin
{
private static bool Check(int[] intArray)
{
if (intArray.Length <= 0)
return false;
return true;
}
public static int? Max(int[] intArray)
{
if (MaxMin.Check(intArray))
{
int max = intArray[0];
for (int i = 0; i < intArray.Length; i++)
{
if (intArray[i] > max)
max = intArray[i];
}
return max;
}
else
return null;
}
public static int? Min(int[] intArray)
{
if (MaxMin.Check(intArray))
{
int min = intArray[0];
for (int i = 0; i < intArray.Length; i++)
{
if (intArray[i] < min)
min = intArray[i];
}
return min;
}
else
return null;
}
}
调用该静态类方法
class Program
{
static void Main(string[] args)
{
int[] intArray = new int[] { 7, 5, 2, 4, 3, 9 };
Console.WriteLine($"最大值{MaxMin.Max(intArray)}");
Console.WriteLine($"最小值{MaxMin.Min(intArray)}");
}
}
UiPath解决方案



练习 2 - 泛型值
添加和连接泛型值变量
在序列中创建四个通用值类型变量:
- A,值为“123”
- B,值为“456”
- C,值为 123
- D,值为 456
将以下各变量运算打印到控制台并查看结果:
- A + B
- C + D
- A + C
- C + A
解决方案

练习 3 - 切换
使用“切换”划分错误代码集合
假设有一个存储在字符串数组中的错误代码集合,根据错误代码类型(“Ax”、“Bx”或“Cx”)将其划分为几个类别,并分别存储在 3 个不同的数组中。
注意:初始数组应包含以下值:
“Ax001”、“Ax002”、“Ax003”、“Ax004”、“Ax005”、“Bx001”、“Bx002”、“Bx003”、“Cx001”、“Cx002”、“Cx003”、“Cx004”
解决方案
流程和变量

switch

Add To Collection 配置

文档
边栏推荐
猜你喜欢

6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
![[Pytorch study notes] 10. How to quickly create your own Dataset dataset object (inherit the Dataset class and override the corresponding method)](/img/71/f82e76085f9d8e6610f6f817e2148f.png)
[Pytorch study notes] 10. How to quickly create your own Dataset dataset object (inherit the Dataset class and override the corresponding method)

网络信息安全运营方法论 (中)

初识机器学习

基于STM32F407的一个温度传感器报警系统(用的是DS18B20温度传感器,4针0.96寸OLED显示屏,并且附带日期显示)

Tensorflow2 与 Pytorch 在张量Tensor基础操作方面的对比整理汇总

MSRA proposes extreme masking model ExtreMA for learning instances and distributed visual representations

网络ID,广播地址,掩码位数计算

Redis设计与实现(第三部分):多机数据库的实现

LeetCode刷题之第24题
随机推荐
【Promise高级用法】实现并行和串行API
LeetCode刷题之第1024题
常见的 PoE 错误和解决方案
电子产品量产工具(2)- 输入系统实现
【Multisim仿真】直流稳压电源设计报告
七、请求处理——Map、Model类型参数处理原理
全尺度表示的上下文非局部对齐
电子产品量产工具(5)- 页面系统实现
ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
LeetCode刷题之第86题
LeetCode刷题之第416题
《基于机器视觉测量系统的工业在线检测研究》论文笔记
[Pytorch study notes] 10. How to quickly create your own Dataset dataset object (inherit the Dataset class and override the corresponding method)
八、响应处理——ReturnValueHandler匹配返回值处理器并处理返回值原理解析
(oj)原地移除数组中所有的元素val、删除排序数组中的重复项、合并两个有序数组
读论文 - Unpaired Portrait Drawing Generation via Asymmetric Cycle Mapping
MSRA proposes extreme masking model ExtreMA for learning instances and distributed visual representations
CAN、CAN FD
深度学习系列(一)简介、线性回归与成本函数
手把手教你搭建小程序