You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 2
Next »
Описание
The Switch statement is an extended version Condition "If ... then ..." (Statement "IF") ...
If the “IF” statement has only two outcomes - True or False (green or red branches), then Switch has the ability to choose several options. In the absence of the desired option, the cube will be released on the “Default” branch.
How do I add an action to a project?
Via the context menu Add Action → Logic → Switch
Or use smart search .
What is it used for?
How do I use the action?
Variable
Here you need to specify the variable that we will check
Usage example
Imagine a situation in which we have a value for the switch_test variable.
Next, let's create operations Notification (Notification / Logging) for each of the options.
Example video
bandicam 2020-08-06 22-36-18-491.mp4 For those who want to work with C # code
You can implement similar functionality via C # C # code (C sharp code .net)
Sample code for the option above
string switch_var = project.Variables["switch_test"].Value;
switch(switch_var){
case "A":
project.SendInfoToLog("В переменной заключена буква A", true);
break;
case "B":
project.SendInfoToLog("В переменной заключена буква B", true);
break;
case "C":
project.SendInfoToLog("В переменной заключена буква C", true);
break;
case "D":
project.SendInfoToLog("В переменной заключена буква B", true);
break;
case "E":
project.SendInfoToLog("В переменной заключена буква E", true);
break;
default:
project.SendInfoToLog("Не обнаружено нужное соответствие, значение переменной: " + project.Variables["switch_test"].Value, true);
break;
}
useful links
Working with variables
Variable window
Condition "If ... then ..." (Statement "IF")
Notification (Notification / Logging)