Returns this value decremented by one.
fun main() { //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 }xxxxxxxxxx val a = 3val b = a.dec()println(a) // 3println(b) // 2var x = 3val y = x-- println(x) // 2println(y) // 3val z = --xprintln(x) // 1println(z) // 1 Open in Playground →Target: JVMRunning on v.2.1.20
fun main() { //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 }
xxxxxxxxxx
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
Thanks for your feedback!