Programming structures: 'if ... else if ... else'
The "structure if ... else if ... else " adds a third part to " if ... else ". When the condition in the " if " not the condition is met in the " else if " if the condition is met it performs the code inside the " else if " if not it runs what is inside the " else ". In this structure only a block of code is ran if the condition in the " if " is met it skips what is in the " else if " and " else " although the condition in the " else if " is true. The " else if " within the structure can be added if necessary. This structure is used as follows: first we will put a "cycle if " menu of " logic " and then we click on the gear and drag the block " else if " and one " else " inside the " if " in the window that appears.

Then we go back and click on the gear to close the menu and add the comparison blocks we need to follow our structure " if ... else if ... else ":

Example 1:
In this example we will turn on the blue LEDs when the button 1 is pressed, the green LED on if the 2 button is pressed and if no condition is met they are going to shut down.

If you press the button 1 "function read " button returns us 1, so the condition is met in the " if " and the code does what is inside the first " do " turning on the LEDs in blue. If they do not the first condition in the program in the "else if " was not met. If this is true the program performs what is inside the second " do " turning on the LEDs in green. If none of the above conditions are fulfilled the program does what is in the " else ".