Else

Defines the command block that is executed when the condition of the If (if) command is not met.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Defines the command block that is executed when the condition of the If (if) command is not met.

Use Else if (elseIf) to check a different set of conditions.

Dependencies

You must use an If (if) command first.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

else

Example

The If (if) command checks if the variable is equal to 10, displaying a message telling the user how to enter a prize draw. Otherwise, the Else command displays a message on the screen stating that the user can't participate in the draw.

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.