We use variables for storing data. They have a name and a type. The type says what type of data we can store in it. For example, if we are calculating total amount we spent on some items, we could use these 3 variables:
amount
that has type Integer
price
that has type Real
total
that has type Real
Before we use it, we must declare a variable. Click on the edge and add a "Declare" block. Click on it and then:
amount
for variable nameInteger
for its type3
for its initial valueDo the same for price
, set its type to Real
and value to 1.5
Now we can finally calculate the total amount.
Declare total
, set its type to Real
and value to amount * price
This last part is very important. You can use variable name as a value!
Of course, you should also add "Output" with value total
, so you can see that it works!