Let's start with something simple: numbers. In Haskell we have numbers like 4
, 1.5
, -89
or 200139
.
We can have numbers as small or big as we want!
And what can we do with a number? Well, for instance we can label it, to give it some meaning. For instance, if within a Haskell program you want to say that a week has 7 days, you can write:
daysPerWeek = 7
If you want to say that the solar system has 8 planets, you can write:
planetsOfTheSolarSystem = 8
Try it yourself: write a Haskell program saying that
daysOfJanuary
is 31.
If you have experience with languages like C
or Java
, we have good news for you: Haskell is smart enough to automatically handle precision in most cases.
You must sign in before submitting your solutions