Two dashboard buttons that add and subtract one from the same variable.
This tutorial is part of the Nairda learning path. You can build it step by step inside the app, which checks every block you place before letting you move on.
The steps
- We add a While loop, which repeats forever.
- We create a number variable called value.
- On the dashboard we draw a label and name it value.
- We add a button and name it Add.
- We add a second button and name it Subtract.
- On the dashboard canvas we build a Set with a sum inside.
- The sum is value plus 1.
- We drag that block onto the Add button and drop it on Press.
- We build another Set with a subtraction inside.
- This one is value minus 1.
- And we drop it on the Press of the Subtract button.
- Finally we drag the variable value onto the label.
When you finish, the app takes you straight to the next tutorial in the path.