Two of the most common operations with variables are adding 1 to the value of the variable or subtracting 1. Those are the cases when we have the variable as a counter. The process of adding 1 is called incrementation and the process of subtracting 1 is called decrementation.

To access the full video please subscribe to FLLCasts.com
- #954
- 24 Sep 2018
The set up
Let us get back to the example from the tutorial regarding the variables. We want to use a variable to track the amount of lemonade we have instead of piece of paper.
Incrementation
The first way to achieve that is to count the amount of lemonade we have sold. So basically the variable is a counter and it will increase its' value by one each time a lemonade is ordered. As mentioned that process is called incrementation and can be achieved within the LEGO EV3 Software as follows:
Let us take a closer look at what we are actually doing. So first you need to read the current value of the variable, which is performed by the first block.
Next you have to use a math block to add 1 to the read value
and finally you have to write down the result back into the variable.
Decrementation
Another approach will be to have the variable (the counter) storing how much lemonade is left. That would mean that each time a lemonade is ordered we will need to subtract 1 from the current value or decrement the value. This can be achieved the same way, but this time instead of setting the math block to Add we will set it to Subtract. The final program should look as follow:
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Instructors Remote Training
If you are working with students and you want to introduce Robotics to your class or you want to mentor a FLL team, but you are insecure about your technical knowledge in the Robotics field, then this is the right place for you. Having in mind teachers' busy schedule, we have design two different schedules and added an option to design one just for you. FLLCasts's Mindstorms EV3 Robotics Online Training is the perfect match for any teacher.
After the completion of each task the participant has to upload his solution for verification.
- 183
- 280:11
- 156