Imperative Programming HT23, Scala


Some specific Scala things.

Flashcards

How could you define something similar to a $\text{data}$ type in Haskell with classes in Scala?


Use a case class.

Could you define a case class in Scala for an Entry which contains a name and a phoneNumber?


case class Entry(name: String, phoneNumber: String)



Related posts