In your program, you will need to compare values. This post is part of the functional language series, and it is based on a remarkable book Programming Elm Build Safe and Maintainable Front-End Applications by Jeremy Fairbank.
Let’s add to our Basketball module position function that will return the candidate position based on its height. After
elm make src/Basketball.elm we can run it in
With inputs 100, 201, and 206, we run through all branches, but with the string “206,” we triggered
TYPE MISMATCH error. Function names are underlined because VisualStudio Code Elm extension warned me that function needs a signature. More about signatures in future posts.
- How to write a function through several lines
- How to branch multiply times
- Error when different types are compared