Otherwise
Defines a block of commands to run when the conditions defined by the When (when
) command are not met.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Defines a block of commands to run when the conditions defined by the When (when
) command are not met.
Use the Then (then
) command to run a block of commands if the conditions defined by the When (when
) command are met.
Dependencies
You can only use this command with the Case (case
), When (when
) and Then (then
)
commands.
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.
otherwise
Example
The following example shows how to run a block of code if the condition defined by the When command is not met.
defVar --name verifiedCase --type String --value Name
defVar --name leftOperand --type String --value leftOperandValue
defVar --name rightOperand --type String --value rightOperandValue
case --name "${verifiedCase}" --switches "CaseSwitchesAll"
when --left "${leftOperand}" --operator "Equal_To" --right "${rightOperand}"
then
logMessage --message "True verified condition." --type "Info"
otherwise
logMessage --message "False verified condition." --type "Info"
endCase