Created
July 11, 2018 02:46
-
-
Save mhoffman/f741804b7ee19c6c074598eb31b835b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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