Scala practice code