Learning Scala: Recursion

If you like me are learning Scala you might after a bit of coding realize that even if it is possible to write java-like code in Scala – and by using some of the nice features of Scala it will actually be more fun than writing normal Java code. It will quite often look a bit ugly and not feel that natural.

That is because it is not the Scala-way of doing it.

I’m still trying to understand the Scala-way of thinking but it’s not something you pick up over night. I’m taking baby steps and hopefully making some progress every day.

Two articles I found yesterday helped me understand how to assign immutable variables from if-statements and how Scala loves recursion: