Ayfri
07/20/2021, 8:36 AMconsole.count("something")
in Kotlin JVM ?
Documentation of console.count : https://developer.mozilla.org/en-US/docs/Web/API/Console/counthho
07/20/2021, 8:54 AMephemient
07/20/2021, 8:56 AMval counts = mutableMapOf<String, Int>()
fun count(label: String = "default") {
val count = counts.getOrElse(label) { 0 } + 1
counts[label] = count
println("$label: $count")
}
fun countReset(label: String = "default") {
counts.remove(label)
println("$label: 0")
}