"Xor" Exclusive disjunction Version 5 (Java)
Action group: Operators
Description
A logical exception operator that returns True if only one operand is True, otherwise it returns False.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
First operand of boolean type | First operand of boolean type | Robin.Boolean | true | Yes |
Second operand of boolean type | Second operand of boolean type | Robin.Boolean | true | Yes |
Results | ||||
Result | Result variable, true - if only one operand is true, false - otherwise | Robin.Boolean | true |
Special conditions of use
None.
Example of use
Task
There is a "Logical variable 1" with value = true and "Logical variable 2" with value = false. It is required to check the expression Logical variable 1=True OR Logical variable 2=True. If the result is positive, display a dialog box with a message - true, if the result is negative, the message is false.
Solution
Use the actions "Excluding disjunction", "If", "Show message".
Implementation
- Assemble a robot scheme consisting of actions:
- Create a variable with type logical "Logical variable 3" to record the result of action "Exclusive disjunction" into it.
- Move the "Exclusive disjunction" action to the workspace and set its parameters
- Move the "If" action to the workspace and set the action parameter to "Logical variable 3".
- In the "True" branch, add the "Show message" action and set its parameters.
- In the "False" branch, add the "Show message" action and set its parameters.
- Start the robot using the "Start" button and the top panel.
Result
The comparison of variable values has been performed successfully.
A dialog box with the result is displayed.
Обзор
Инструменты контента