arrayOf
Returns an array containing the specified elements.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val emptyArray = arrayOf<Any>()
println(emptyArray.contentToString()) // []
val strings = arrayOf("Hello", "world")
println(strings.contentToString()) // [Hello, world]
val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
println(numbers.contentToString()) // [3.14, 42, 0.123]
//sampleEnd
}Returns an array containing the specified elements.
Since Kotlin
1.1Samples
import kotlin.test.*
fun main() {
//sampleStart
val emptyArray = arrayOf<Any>()
println(emptyArray.contentToString()) // []
val strings = arrayOf("Hello", "world")
println(strings.contentToString()) // [Hello, world]
val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
println(numbers.contentToString()) // [3.14, 42, 0.123]
//sampleEnd
}Returns an array containing the specified elements.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val emptyArray = arrayOf<Any>()
println(emptyArray.contentToString()) // []
val strings = arrayOf("Hello", "world")
println(strings.contentToString()) // [Hello, world]
val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
println(numbers.contentToString()) // [3.14, 42, 0.123]
//sampleEnd
}Returns an array containing the specified elements.
Since Kotlin
1.3Samples
import kotlin.test.*
fun main() {
//sampleStart
val emptyArray = arrayOf<Any>()
println(emptyArray.contentToString()) // []
val strings = arrayOf("Hello", "world")
println(strings.contentToString()) // [Hello, world]
val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
println(numbers.contentToString()) // [3.14, 42, 0.123]
//sampleEnd
}Returns an array containing the specified elements.
Since Kotlin
1.8Samples
import kotlin.test.*
fun main() {
//sampleStart
val emptyArray = arrayOf<Any>()
println(emptyArray.contentToString()) // []
val strings = arrayOf("Hello", "world")
println(strings.contentToString()) // [Hello, world]
val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
println(numbers.contentToString()) // [3.14, 42, 0.123]
//sampleEnd
}Returns an array containing the specified elements.
Since Kotlin
1.8Samples
import kotlin.test.*
fun main() {
//sampleStart
val emptyArray = arrayOf<Any>()
println(emptyArray.contentToString()) // []
val strings = arrayOf("Hello", "world")
println(strings.contentToString()) // [Hello, world]
val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
println(numbers.contentToString()) // [3.14, 42, 0.123]
//sampleEnd
}