How do I get this to work, I've tried with and without new
keyword:
object Main extends App {
override def main (args : Array[String] = new Array("default argument")) {
println("args(0) = " + args(0))
}
}
http://ideone.com/5AyTxy (I have tried other [1, 2] methods but I think that its val
is causing issues)
Docs: http://docs.scala-lang.org/sips/completed/named-and-default-arguments.html#default_arguments
PS: I should confirm that I want this to be bound to the args
name; rather than to another var
or val
. Additionally the scope needs to be global within main
.