0 votes
in Scala Constructs by

Consider the following code snippet

object HelloWorld {

def main(args: Array[String]): Unit = {

println("Hello, World!")

def prnt = {print("scala"); 1}

  def fun(a:Int,b: => Int) = print(a)

  println(fun(prnt,5))

  val s = List (10, 11, 12)

val result = s.flatMap(i => List(i-1, i, i +1))

println(result)

1 Answer

0 votes
by

Output:

Hello, World!

scala1()

List(9, 10, 11, 10, 11, 12, 11, 12, 13)

...