dec

expect operator fun dec(): Char(source)

Returns this value decremented by one.

Since Kotlin

1.0

Samples


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
}
actual operator fun dec(): Char(source)

Returns this value decremented by one.

Since Kotlin

1.1

Samples


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
}
operator fun dec(): Char(source)

Returns this value decremented by one.

Since Kotlin

1.0

Samples


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
}
actual operator external fun dec(): Char(source)

Returns this value decremented by one.

Since Kotlin

1.3

Samples


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
}
actual inline operator fun dec(): Char(source)

Returns this value decremented by one.

Since Kotlin

1.8

Samples


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
}
actual inline operator fun dec(): Char(source)

Returns this value decremented by one.

Since Kotlin

1.8

Samples


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
}