object Main extends App { val l = List(1,2,3,4,5) var i=0val a= l.map(x=>(i=i+1,2)) println(a) }
Standard input is empty
List(((),2), ((),2), ((),2), ((),2), ((),2))
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!