Numbers
We have 2 types of numbers:
- integers - whole numbers:
5
,-23
,0
,19
- real numbers - numbers "with comma":
3.14
,0.004
,-3.33
We can do the basic operations on them: +
, -
, *
, /
and %
(remainder).
Why do we need 2 types of numbers?
The mathematical operations on them can give different results.
We need both of them, depending on the problem we are trying to solve.
The main difference is when we use division:
- dividing integers gives an integer:
5 / 2 = 2
- dividing reals gives a real:
5.0 / 2.0 = 2.5
Try to play around with the "output" block, use it as a simple calculator.
Do these calculations:
5 / 2
5.0 / 2.0
8 * 3.14