How to make a "counter" for variables

Updated 1 week ago by Fran

Easy solution to set up a counter/loop to add up variables

Before beginning, you can check a demo in here.

In this example we will create a counter with a variable called @score. Our flow should look something like this:

  1. Create the variable @score with a Set A Variable block, with a  Number format and a value of 0:
  2. Once the step that needs to be counted has passed, we add another Set A Variable block using the same variable but with calculations:

Bear in mind that when working with numbers, Landbot adds 1 decimal. So even if you establish 0 or 1, it will become 0.0 or 1.0. In case you are working with conditionals, you need to work with decimals too. Example "if @score = 1.0"


How did we do?