If
Command Description
If the condition is true, execute the following block of statements; if the condition is false, skip the following block of statements. It can also be combined with other conditional statements to complete more complex logic.
Command Prototype
If expression
End If
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
expression | True | expression | 1 > 0 | The 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