8. AI Development8. AI Development\8.4 Conditions and Actions8.4 Conditions and Actions\8.4.4 Advanced Actions

8.4.4  Advanced Actions

Statement or Expression:

A statement (or expression) is simply a single line of code that performs some action. All statements/expressions end with a semicolon. It might be

v  to declare a variable,

v  to add two numbers,

v  to compare two values, etc...

In the CSR_Rescue, you can write your own statement in the advanced action panel instead of using the graphical interface.

Picture25

If statement:

Flow chart:

Program:

 

If – else statement:

v  If the condition is true, execute the first block of code.

v  If that condition is not true, then execute the second block of code.

Program:

 

Switch Statements

v  A switch statement is literally saying, “Switch the path you take through the code based on the value of some variable.”

v  A switch can only be done on a single character or on an integer value.

Flow Chart:

Program:

 

Top of Page