I want to introduce you slowly to more complex problems. This one is still fun, as you know, the main topic is
flatMap but you are going to get an intuition for a little more.
Enjoy the ride.
Did you get
flatMap ? It is
map followed by
flatten. Try to replace the
flatMap in the code above by
map and add
flatten after it.
Ok, now that the topic of today's episode is done. What is the wizardry with all the
case ?! This is called pattern matching. I am sure that, right now, you have a good intuition about it, but we are going to dive more into it, soon.