"==" Equal to Version 6 (Java)

Action group: Operators


Description

Returns True if the first operand is equal to the second operand. Otherwise False.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
First operandValue or variable of the first opreandRobin.Object
Yes
Second operandValue or variable of the second opreandRobin.Object
Yes
Results
ResultThe result of the comparison, true if the two numbers (or untyped objects) are equal, false otherwise.Robin.Booleantrue

Special conditions of use

None.

Example of use 

Task

There is "Variable1" with value = 17 and "Variable2" with value = 3. It is required that Variable1=Variable2. If the result is positive, output a dialog box with a message - true, if the result is negative, output a dialog box with a message - false. 

Solution

Use the actions "Equal to", "If", "Show message". 

Implementation

  1. Assemble a robot scheme consisting of actions:

  2. Create a variable with the boolean type "Variable3" to record the result of the "Equal" action into it. 
    image2024-1-30_17-42-28.png
  3. Move the "Equal to" action to the workspace and set its parameters. 
  4. Move the "If" action to the workspace and set the action parameter to "Variable3". 
    image2024-1-30_17-43-28.png
  5. In the "True" branch, add the "Show message" action and set its parameters.
    image2024-1-30_17-43-48.png
  6. In the "False" branch, add the "Show message" action and set its parameters.
    image2024-1-30_17-44-5.png
  7. Launch the robot using the "Start" button and the top panel. 

Result

The comparison of variable values has been performed successfully, the dialog box with the result is displayed 

 

  • Нет меток