Skip to main content

If-the-Condition-Is-True-,-the-Next-Operation-Is-Performed

Command Description

If the expression "expression" is true, the Yes Block is executed; otherwise, the "No Block" is executed. ElseIf statements may appear multiple times with more conditional branches. ElseIf, Else statements, and the corresponding statement Block are not necessary

Command Prototype

If expression 

End If

Parameter Description

ParameterRequiredTypeDefaultDescription
expressionTrueexpression1 > 0The expression used for judgment

Demo

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