Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env scala -savecompiled
object Main extends App {
def getName(y: Any) = {
val list = y.getClass.toString.split("\\$").map(_.trim).toList
list(list.length - 1)
}
object x {
}
val abc = scala.collection.mutable.ArrayBuffer
case class Person (var name: String, var age: Int)
var peter = Person("Peter", 31)
List(x, peter).foreach{ z =>
println(z, getName(z))
}
}
Main.main(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment