Expand KDoc of inc() and dec() operators #KT-43701

This commit is contained in:
Abduqodiri Qurbonzoda
2021-01-18 00:50:15 +03:00
parent b311820159
commit 98d31a1813
16 changed files with 418 additions and 75 deletions
@@ -0,0 +1,46 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package samples.misc
import samples.*
class Builtins {
@Sample
fun inc() {
val a = 3
val b = a.inc()
assertPrints(a, "3")
assertPrints(b, "4")
var x = 3
val y = x++
assertPrints(x, "4")
assertPrints(y, "3")
val z = ++x
assertPrints(x, "5")
assertPrints(z, "5")
}
@Sample
fun dec() {
val a = 3
val b = a.dec()
assertPrints(a, "3")
assertPrints(b, "2")
var x = 3
val y = x--
assertPrints(x, "2")
assertPrints(y, "3")
val z = --x
assertPrints(x, "1")
assertPrints(z, "1")
}
}