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)

Related questions

0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
0 votes
asked Dec 7, 2023 in Angular by GeorgeBell
...