Exercise 1: The numbers

The numbers

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.

Give me a hint!

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

Oops, your solution didn't work

  • Check that your program does not have recursion or an infinite loop
  • Check that you have an internet connection
  • Wait a while and try again

We are processing you solution

Please press F5 if results are not displayed after a few seconds