If Version 11 (Java)
Action group: Base actions
Description
The action determines which operator will be executed when a condition specified by a boolean expression is met.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Condition | Boolean expression. The result of executing a comparison operator or a logical operator is a logical value of the «Boolean» | Robin.Boolean | true | Yes |
Special conditions of use
The "If" condition can have only two branches. Each branch already has the result of the expression ("Yes"/"true") and "No"/"false") on which the transition to this branch will be performed. To add a sequence of actions to the branch body, you must move them to the outline of the corresponding action.
Example of use
Task
There are two numeric variables. The first with value = 10, the second with value = 11. Compare the variables. If the first variable is greater than or equal to the second, display a message, if not, play a sound.
Solution
Use the "If" action.
Implementation
1.Move the "Greater than or equal to" action to the workspace and customize it by specifying the required variables in the parameters and create a boolean type variable to specify the result of the action.
2. Move the "If" action to the workspace and set its parameters.
In the action condition, specify the variable "Result of variable comparison".
Set the "Show message" and "Sound" actions.
3. Start the robot by clicking "Start" in the top panel.
4. The output of the action is a sound being played.
Result