"Or" Disjunction Version 5 (Java)

Action group: Operators 


Description

A logical addition operator (logical OR) that returns True if either operand is True, otherwise it returns False.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
First operand of boolean typeFirst operand of boolean typeRobin.BooleantrueYes
Second operand of boolean typeSecond operand of boolean typeRobin.BooleantrueYes
Results
ResultResult variable, true - if at least one operand is true, false - otherwiseRobin.Booleantrue

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 AND/OR Logical variable 2=True.  If the result is positive, print a dialog box with a message - true, if the result is negative, the message is false. 

Solution

Use the "Disjunction", "If", and "Show message" actions.  

Implementation

  1. Assemble a robot scheme consisting of actions: 

  2. Create a variable with type logical "Logical variable 3" to record the result of the "Disjunction" action into it. 
  3. Move the "Disjunction" action to the workspace and set its parameters. 
  4. Move the "If" action to the workspace and set the action parameter to "Logical variable 3". 
  5. In the "True" branch, add the "Show message" action and set its parameters.
  6. In the "False" branch, add the "Show message" action and set its parameters.
  7. Start the robot using the "Start" button and the top panel. 

Result

Variable value comparison was successful.


A dialog box with the result is displayed.

  • Нет меток