Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#odersky-programming-in-scala-2ed #scala
Question
How to apply array of strings to echo?
val arr = Array("What's", "up", "doc?")

def echo(args: String*) =
  for (arg <- args) println(arg)
Answer
?

Tags
#odersky-programming-in-scala-2ed #scala
Question
How to apply array of strings to echo?
val arr = Array("What's", "up", "doc?")

def echo(args: String*) =
  for (arg <- args) println(arg)
Answer
add colon and _* symbol to the argument:

echo(arr: _*)

Tags
#odersky-programming-in-scala-2ed #scala
Question
How to apply array of strings to echo?
val arr = Array("What's", "up", "doc?")

def echo(args: String*) =
  for (arg <- args) println(arg)
Answer
add colon and _* symbol to the argument:

echo(arr: _*)
If you want to change selection, open document below and click on "Move attachment"

pdf

cannot see any pdfs

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill


Discussion

Do you want to join discussion? Click here to log in or create user.