First Scala

I was hoping for

def sayHello(name) {
  println("Hello, " + name)
}

("world", "Adam").foreach(sayHello)

but will have to settle for

def sayHello(name: String) {
  println("Hello, " + name)
}

List("world", "Adam").foreach(sayHello _)

Leave a Reply

Your email address will not be published. Required fields are marked *