inc

expect operator fun inc(): Long(source)

Returns this value incremented by one.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4

var x = 3
val y = x++
println(x) // 4
println(y) // 3

val z = ++x
println(x) // 5
println(z) // 5 
   //sampleEnd
}
actual operator fun inc(): Long(source)

Returns this value incremented by one.

Since Kotlin

1.1

Samples


fun main() { 
   //sampleStart 
   val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4

var x = 3
val y = x++
println(x) // 4
println(y) // 3

val z = ++x
println(x) // 5
println(z) // 5 
   //sampleEnd
}
operator fun inc(): Long(source)

Returns this value incremented by one.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4

var x = 3
val y = x++
println(x) // 4
println(y) // 3

val z = ++x
println(x) // 5
println(z) // 5 
   //sampleEnd
}
actual operator external fun inc(): Long(source)

Returns this value incremented by one.

Since Kotlin

1.3

Samples


fun main() { 
   //sampleStart 
   val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4

var x = 3
val y = x++
println(x) // 4
println(y) // 3

val z = ++x
println(x) // 5
println(z) // 5 
   //sampleEnd
}
actual inline operator fun inc(): Long(source)

Returns this value incremented by one.

Since Kotlin

1.8

Samples


fun main() { 
   //sampleStart 
   val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4

var x = 3
val y = x++
println(x) // 4
println(y) // 3

val z = ++x
println(x) // 5
println(z) // 5 
   //sampleEnd
}
actual inline operator fun inc(): Long(source)

Returns this value incremented by one.

Since Kotlin

1.8

Samples


fun main() { 
   //sampleStart 
   val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4

var x = 3
val y = x++
println(x) // 4
println(y) // 3

val z = ++x
println(x) // 5
println(z) // 5 
   //sampleEnd
}