import kotlin.* const val intArray1 = IntArray(42).size const val intArray2 = IntArray(42)[0] const val intArray3 = IntArray(10) { 42 }[0] const val intArray4 = IntArray(10) { it -> it }[7] const val floatArray1 = FloatArray(42).size const val floatArray2 = FloatArray(42)[0] const val floatArray3 = FloatArray(10) { 42.5f }[0] const val floatArray4 = FloatArray(10) { it -> it.toFloat() }[7] const val booleanArray1 = BooleanArray(42).size const val booleanArray2 = BooleanArray(42)[0] const val booleanArray3 = BooleanArray(10) { true }[0] const val booleanArray4 = BooleanArray(10) { it -> it != 0 }[7] const val charArray1 = CharArray(42).size const val charArray2 = CharArray(42)[0] const val charArray3 = CharArray(10) { '4' }[0] const val charArray4 = CharArray(50) { it -> it.toChar() }[48] const val array = Array(4) { when(it) { 0 -> 1 1 -> 2.0 2 -> "3" 3 -> null else -> throw IllegalArgumentException("$it is wrong") } }.let { it[0].toString() + " " + it[1] + " " + it[2] + " " + it[3] } @CompileTimeCalculation // can't be marked as const, but can be used in compile time evaluation val Int.foo: Int get() = this shl 1 const val arrayWithPropertyAtInit = IntArray(3, Int::foo).let { it[0].toString() + " " + it[1] + " " + it[2] }