Between Version 4 (Java)

Action group: Operators 


Description

Returns True if what is being checked is within the specified values. Otherwise False.

Action icon

 

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Number to checkNumber to checkRobin.Numeric
Yes
Number 1Number 1Robin.Numeric
Yes
Number 2Number 2Robin.Numeric
Yes
Results
ResultA Boolean variable equals to true if the real number to check is in the interval between the other two real numbers 1 and 1, otherwise false.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 to check whether the value 4 is between the values of variables 1 and 2.  If the result is positive, display a dialog box with a message - correct, if the result is negative, display a dialog box with a message - incorrect. 

Solution 

Use the actions "Between", "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 "Between" action into it. 

  3. Move the "Between" action to the workspace and set its parameters. 
  4. Move the "If" action to the workspace and set the action parameter to "Variable3". 
  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. 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 

  • Нет меток