Skip to main content
Version: v6.5.0

ElseIf

Command Description

It needs to be used in combination with the "If condition is true" (If) statement. When the previous condition is not true, further check whether this condition is true. If it is true, execute the following statement block; otherwise, skip the following statement block.

Command Prototype

ElseIf expression


Parameter Description

ParameterRequiredTypeDefaultDescription
expressionTrueexpression1 > 0The expression used for judgment

Demo

TracePrint("--------------------------------------Conditional branch--------- ----------------------------------") 
//-------------------------------------------------------------------------------
//[Remarks] If the expression expression is true, execute the Yes Block statement block, otherwise execute the No Block statement block. The ElseIf statement can appear multiple times, corresponding to more conditional branches. If the ElseIf and Else statements are not required, they can be omitted, and the corresponding statement block does not need to be written.
TracePrint("Let the variable a be UiBot, the conditional branch judge whether a is equal to 1, and then judge whether a is equal to UiBot and execute the corresponding statement block")
a = "1"
If a = 1
TracePrint "yes"
ElseIf a = "UiBot"
TracePrint "no"
End If