Scala defined type

Let's make our own type!

You saw how to parameterize the entire code.

Try changeMyTypefromInttoString.

This seem simple but it is a building block required to understand generic type later.

If you want to start now, try to replaceMyTypeby the following code:

type SubType = Int type MyType = List[SubType]
Do you see how you can combine types together ? Like Lego !

Listcan be parameterized, we used it withIntandStringin the past, but you can use any type you want.

Reveal more information and clues
Load Exercise