  MENU AI Robot Technologies [OpenR8 solution] If (Conditional)
1. ### Chapter1: If Introduction

If refers to the conditional expression, whether the condition is met, and if it is satisfied, it will do the specified thing. The conditions are usually like "assuming something has happened (or not)", or "assuming string A is equal to string B". This requires a "yes" and a "no" condition.

The following sections describe how to use conditional functions.

1. ### Chapter2: If folder introduction

If it is in the solution folder of OpenR8, as shown in Fig. 1, there are three flow files, such as Fig. 2.

1. If.flow: A conditional number greater than 5 and less than 5.
2. If_ElseIf.flow: A conditional number with a number less than 3, equal to 3, and greater than 7.
3. If_IsEqualString.png: Compares the conditional expressions of the string. Fig. 1. If location. Fig. 2. If folder.

1. ### Chapter3: If.flow — Determine if the number is greater than 5 or less than 5

Please double-click【R8_Python3.6_CPU.bat or R8_Python3.6_GPU.bat】 => 【File】 => 【Open】=>【Enter the solution folder under OpenR8】=>【Select If folder】=>【Load If.flow】,as shown in Fig. 3、Fig. 4. Fig. 3. Select If.flow. Fig. 4. Open If.flow.

Press to Run, the result is shown in Fig. 5.

Fig. 6 is the flow of the If.flow file. Fig. 5. Execution solution. Fig. 6. If.flow.

※ The usage of the conditional function can be found in Chapter 6.

1. ### Chapter4: If_ElseIf.flow— Number greater than 7, equal to 3 or less than 3

Please double-click【R8_Python3.6_CPU.bat or R8_Python3.6_GPU.bat】 => 【File】 => 【Open】=>【Enter the solution folder under OpenR8】=>【Select If folder】=>【Load If_ElseIf.flow】,as shown in Fig. 7, Fig. 8. Fig. 7. Select If_ElseIf..flow. Fig. 8. Load If_ElseIf..flow.

Press to Run, the result is shown in Fig. 9.

Fig. 10  shows the flow of the If_Else.flow file. Fig. 9. Running the solution. Fig. 10. If_ElseIf..flow.

※ The usage of conditional functions can be found in Chapter 6.

1. ### Chapter5: If_IsEqualString.flow — Conditional for judging whether strings are equal

Please double-clickR8_Python3.6_CPU.bat or R8_Python3.6_GPU.bat => File => Open=>Enter the solution folder under OpenR8=>Select If folder=>Select If_IsEqualString.flow,as shown in Fig. 11, Fig. 12. Fig. 11. Select If_IsEqualString.flow. Fig. 12. Open If_IsEqualString.flow.

Press to execute, the result is shown in Fig. 13.

Fig. 14  shows the flow of the If_IsEqualString.flow file. Fig. 13. Running the solution. Fig. 14. If_IsEqualString.flow.

※ The usage of the conditional function can be found in Chapter 6.

1. ### Chapter6: If Conditional description Fig. 15. If function.

As shown in Fig. 15, the judgment formula (if) has only two fields, the conditional object for storing the condition, and the bool for judging true or false.

How to trigger this condition? It is determined by whether the Boolean value is True (1, Yes) or False (0, No).

Where is the Boolean value come from? From comparison with each other, such as the number A is greater than the number B, the string C and the string D are not the same, π (3.14...) is less than 3.2, if the condition is met, it is True. If the condition is not met, it is False, as shown in Fig. 16. Fig. 16. Relationship between the if function and the compare function.

The condition setting currently has three major functions: if, if_Not, if_IsEqualString (if stringA = stringB), the relationship can be seen in Fig. 17, Fig. 18's [If] is the opposite of [If_Not] function. [If] Input is True to specify the function to be done, and [If_Not] input is False to specify the function to be done. Fig. 17. Conditions for conditional operation.

The most commonly used conditional usage is "If the number A is greater than the number B, then do... things (the number A is not greater than the number B) and do the thing". The use of the program is the usage of if or else, and its function flow is as follows Fig. 18. Fig. 18. if, if_else, if_not.

※Addition: “If the numberA is greater than the numberB, do it... when the number A is equal to the number B, do it...do not do it...”, as opposed to the if, else if, and else in the program. Fig. 19.. Fig. 19. else if conditional flow.

Tag: