Sometimes, it may happen that the value passed to a switch statement block does not match any of the foreseen cases. Which case of the switch is going to be executed? None? The first one?

To access the full video please subscribe to FLLCasts.com
- #1172
- 22 Mar 2019
Then, the default case is executed when the data evaluated by the switch block does not match any of the cases. The default case is one of all given cases and is marked with a dot:
You can change the default case by just selecting any other case as shown:
NOTE: if you delete the defaut case, the first case will become default:
A good practice is to have a case with a value that can not be met, usually -1. That case is set to default and covers any errors and unexpected data. Within the case you can put a sound block with "Error" or some other notification for the occured error.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Robotics with LEGO - Level 3.5 - Measuring tools
The sixth level of the Robotics with LEGO curriculum for students in sixth or seventh grade.
In this level, we introduce student-created myBlocks. Any functionality that is used in several places in a program is grouped into myBlock thus shortening the program's length. Students create blocks that return the result of calculations as an output parameter. Input parameters can change the calculations in the myBlocks. The robot constructions measure physical properties like linear or rotational speed, the fuel level in a tank, or length, area and volume.
- 58
- 0:00
- 185

Robotics with LEGO - Level 3.5 - Measuring tools
The sixth level of the Robotics with LEGO curriculum for students in sixth or seventh grade.
In this level, we introduce student-created myBlocks. Any functionality that is used in several places in a program is grouped into myBlock thus shortening the program's length. Students create blocks that return the result of calculations as an output parameter. Input parameters can change the calculations in the myBlocks. The robot constructions measure physical properties like linear or rotational speed, the fuel level in a tank, or length, area and volume.
- 58
- 0:00
- 185

Robotics with LEGO - Level 3.0 - Security systems
This is the fifth level of the Robotics with LEGO curriculum for students in fifth to twelfth grades.
In this level students will learn how to work with data measured by the sensors. The concept of Algorithm is introduced and the programs perform calculations without knowing the values beforehand. The programming blocks transfer data between each other via data wires. The robots are designed to address the problems of security systems. Variety of alarm systems are built and the physical principles of different security methods are considered.
- 50
- 1:03
- 213

Lesson 6 - PIN code, Access codes
Introduction
In the previous lesson we prevented the cake robbers from escaping our prison but the attention they received had a negative impact on society. At schools students started imitating them and stealing their fellows’ desserts. This should stop once and forever! To cope with the problem we are going to launch a new type of lunch boxes which require a password to open.
- 7
- 7
- 20
- 3d_rotation 1

Robotics with LEGO - Level 4.0 - Kinesthetic and Memory Game (in development)
The seventh level of the Robotics with LEGO curriculum for students in sixth or seventh grade.
In this level, student develop a memory training game. The player must remember series of actions like press a button, shake a pole, pull a lever, show one of many colors. In order to program the game, students use many variables and modify their states. Students create their own custom sounds and images, in order to reflect their own personality in the game. In the end of the level, the game stores top scores even after a full shut down with the help of text files.
- 59
- 2:58
- 200

Припомнете си как се работи с условни оператори и кога се използва
Sometimes you need to evaluate the value of a sensor or some other data and depending on the value to execute one action or other. In a way we have achieved that so far, using the switch block, but we have had only two cases - if the statement is true do one thing and if the statement is false do another. However, sometimes we need more than two cases and then we use the switch block as a switch statement.
- 3
- 0
- 0
- 3d_rotation 0

Robotics with LEGO - Level 1.5 - Spy games
The second level of the Robotics with LEGO curriculum for students from fifth to twelfth grades.
Students build multiple robots with thread chains and become familiar with the physical concepts of momentum and center of gravity. The concept of gears, their use and basic constructions involving gears are studied.
The new concept of "condition" is introduced in programming. Robots are becoming smarter as they can make complex decisions on their own. "Spy robots" follow their targets and avoid being noticed. This level introduces the light sensor which the robots use to recognize the colors of the objects they are looking for. Robots can stop on a black line and follow a route marked with a colored line on the floor.
The spy's most complex mission in the end of the level is to turn into a sumo wrestler and defeat any other robot in the ring.
- 56
- 12:47
- 136