object Main extends App { val list = List(1,2,3,4) def sqr(x:Int) = x*x println(list.map(sqr))}
Standard input is empty
List(1, 4, 9, 16)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!