Else

定义在不满足 If (if) 命令的条件时执行的命令块。

命令可用性: 本地 IBM RPA SaaS 和 IBM RPA

描述

定义在不满足 If (if) 命令的条件时执行的命令块。

使用 Else if (elseIf) 来检查另一组条件。

依赖关系

必须首先使用 If (if) 命令。

脚本语法

IBM RPA 的专有脚本语言的语法与其他编程语言类似。 该脚本语法在脚本文件中定义命令的语法。 您可以在 IBM RPA Studio的 脚本 方式下使用此语法。

else

示例

If (if) 命令检查变量是否等于 10 ,显示一条消息告知用户如何输入抽奖。 否则, Else 命令会在屏幕上显示一条消息,指出用户无法参与抽签。

defVar --name studentAverage --type Numeric --value 9 --parameter
if --left "${studentAverage}" --operator "Equal_To" --right 10
    messageBox --title Grade --text "Congratulations! You have completed the semester with an average of 10! Get your draw number from the office!" --icon "Information" --buttons "OK" --defaultbutton "FirstButton"
else
    messageBox --title Grade --text "Congratulations! You have completed the semester! Unfortunately only students with an average of 10 can participate in the draw. Good luck next semester!" --icon "Information" --buttons "OK" --defaultbutton "FirstButton"
endIf
logMessage --message "Student Average: ${studentAverage}" --type "Info"
// Shows whether the student can enter the prize draw if the average is 10, or not if the average is not 10.