dec

Common
JVM
JS
Native
1.0

Returns this value decremented by one.



fun main(args: Array<String>) {
//sampleStart
val a = 3
val b = a.dec()
println(a) // 3
println(b) // 2

var x = 3
val y = x--
println(x) // 2
println(y) // 3

val z = --x
println(x) // 1
println(z) // 1
//sampleEnd
}