Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Imagine you're working on an application where you track all your expenses. You need to represent an expense that consists of a name and a cost – for example, a 5$ meal at McDonald's. How would you represent it in Scala?
- val meal = ("McDonald's" , 5)
- val name = meal._1
- val cost = meal._2
- println (s"A $cost$$ meal at $name.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement