История страницы
...
If Version 11 (Java)
Группа действий: Базовые действия
Описание
Данное действие предназначено для определения какой оператор будет выполняться при выполнении условия, заданного логическим выражением.
...
Action group: Base actions
...
Description
The action determines which operator will be executed when a condition specified by a boolean expression is met.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Condition | Boolean expression. The result of executing a comparison operator or a logical operator is a logical value of the «Boolean» | Robin.Boolean | true | Yes |
Особые условия использования
Special conditions of use
The "If" condition can have only two branches. Each branch already has the result of the expression ("YesУсловие "Если" может иметь только две ветви. На каждой ветви уже указан результат выражения ("Да"/"true") и and "НетNo"/"false") , по которому будет осуществлять переход на данную ветвь. Для добавления в тело ветви последовательности действий необходимо переместить их на контур соответствующего действия.
Пример использования
Задача
Имеется две числовых переменных. Первая со значением = 10, вторая со значением = 11. Произвести сравнение переменных. Если первая переменная больше или равна второй, то вывести на экран сообщение, если нет, то проиграть звук.
Решение
Воспользоваться действием "Если".
Реализация
1.Перенести на рабочую область и настроить действие "Greater than or equal to", указав требуемые переменные в параметрах и создать переменную логического типа для указания результата действия.
2. Перенести на рабочую область и настроить действие "If".
В условии действия указать переменную "Результат сравнения переменных".
Настроить действия "Сообщение" и "Звук".
3. Запустить робота по кнопке "Запуск" в верхней панели.
4. В результате действия "Если" проигран звук.
...
on which the transition to this branch will be performed. To add a sequence of actions to the branch body, you must move them to the outline of the corresponding action.
Example of use
Task
There are two numeric variables. The first with value = 10, the second with value = 11. Compare the variables. If the first variable is greater than or equal to the second, display a message, if not, play a sound.
Solution
Use the "If" action.
Implementation
1.Move the "Greater than or equal to" action to the workspace and customize it by specifying the required variables in the parameters and create a boolean type variable to specify the result of the action.
2. Move the "If" action to the workspace and set its parameters.
In the action condition, specify the variable "Result of variable comparison".
Set the "Show message" and "Sound" actions.
3. Start the robot by clicking "Start" in the top panel.
4. The output of the action is a sound being played.
Result