Index access Operator in Kotlin Hindi

Here are some expressions using index access operator with corresponding functions in Kotlin.

Expression Translated to
a[i] a.get(i)
a[i, n] a.get(i, n)
a[i1, i2, ..., in] a.get(i1, i2, ..., in)
a[i] = b a.set(i, b)
a[i, n] = b a.set(i, n, b)
a[i1, i2, ..., in] = b a.set(i1, i2, ..., in, b)

Example: Index access Operator

fun main(args: Array<String>) {

    val a  = intArrayOf(1, 2, 3, 4, - 1)
    println(a[1])   
    a[1]= 12
    println(a[1])
}

When you run the program, the output will be:

2
12