Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

"<="

...

Less than or equal to Version 5 (Java)

Группа действийAction group: Операторы Operators

...

Description

Возвращает True, если первый операнд меньше второго или равен ему. Иначе Returns True if the first operand is less than or equal to the second operand. Otherwise False.

...

Action icon

Image Removed

Параметры действия

Входные параметры

Поле "Операнд 1" - Выражение, имеющее результат числового типа или числовая переменная.

Поле "Операнд 2" - Выражение, имеющее результат числового типа или числовая переменная.

Выходные параметры

Результат - логическая переменная, которая содержит результат действия

Настройки

...

Свойство

...

Англ. наименование

...

Описание

...

Тип

...

Пример заполнения

...

Обязательность заполнения поля

...

Параметры

...

Image Added

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
First operandValue or variable of the first operandRobin.Numeric
Yes
Second operandValue or variable of the second operandRobin.Numeric
Yes
Results
ResultThe result of the comparison, true if the first number is less than or equal to the other, 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 to check the expression 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 "Less than or equal to", "If", "Show message". 

Implementation

  1. Assemble a robot scheme:
    Image Added
  2. Create a variable with the boolean type "Variable3" to record the result of the "Less than or equal to" action into it. 
    image2024-1-30_17-42-28.pngImage Added
  3. Move the "Less than or equal to" action to the workspace and set its parameters. 
    Image Added
  4. Move the "If" action to the workspace and set the action parameter to "Variable3". 
    Image Added
  5. In the "True" branch, add the "Show message" action and set its parameters.
    Image Added
  6. In the "False" branch, add the "Show message" action and set its parameters.
    Image Added
  7. Launch the robot using the "Launch" button and the top panel. 

Result

The comparison of variable values is successful, the dialog box with the result is displayed 

Image Added

 

Особые условия использования

Отсутствуют.

Пример использования 

Задача

Существует "Переменная 1" со значением = 17 и "Переменная 2" со значением = 3. Требуется проверить выражение Переменная 1<=Переменная 2. При положительном результате вывести диалоговое окно с сообщением - верно, при отрицательном результате с сообщением - неверно. 

Решение

Воспользоваться действиями "Меньше или равно", "Если", "Сообщение". 

Реализация

  1. Создать переменную с типом логический "Переменная 3" для записи в нее результата действия "Больше или равно". 
    Image Removed
  2. Перетащить действие "Меньше или равно" на рабочую область и настроить его параметры. 
    Image Removed
  3. Перетащить действие "Если" на рабочую область и указать в параметре действия "Переменную 3". 
    Image Removed
  4. В ветвь "Истина" добавить действие "Сообщение" и настроить его параметры.
    Image Removed
  5. В ветвь "Ложь" добавить действие "Сообщение" и настроить его параметры.
    Image Removed
  6. Запустить робота по кнопке "Запуск" и верхней панели. 

Результат

Сравнение значений переменных выполнено успешно,  отображено диалоговое окно с результатом 

Image Removed