Numbers
We have 2 types of numbers:
- integers that represent the whole numbers:
5
,-23
,0
,19
- real numbers that represent the 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, depending on the problem we are solving.
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
Play with the Output
block, use it as a simple calculator.
Try different combinations and see how they behave.
Do these calculations:
5 / 2
5.0 / 2.0
8 * 3.14