Array creation syntax?


#1

Did there used to be syntax like:

  val arr = [1,2,3]

or am I remembering other languages? Is this the shortest way:

  val arr = arrayOf(1,2,3)

?

thanks,
Rob


#2

I'd say that's the simplest way, yeah. The first way doesn't work.


#3

I was expecting this simple syntax to create an array known from javascript and dart

var list = [1, 2, 3];

sad this is not possible in kotlin