本文方法及代码示例基于Kotlin 2.1.20 Released
Byte.inc
所在包 kotlin.Byte.inc
,其相关用法介绍如下:
用法:
kotlin
operator fun inc(): Byte
返回此值加一。
示例代码:
kotlin
fun main(args: Array<String>) {
//sampleStart
val a = 3
val b = a.inc()
println(a) // 3
println(b) // 4
var x = 3
val y = x++
println(x) // 4
println(y) // 3
val z = ++x
println(x) // 5
println(z) // 5
//sampleEnd
}
// 输出
3
4
4
3
5
5
相关方法
- Kotlin contentToString用法及代码示例
- Kotlin dropWhile用法及代码示例
- Kotlin distinct用法及代码示例
- Kotlin code用法及代码示例
- Kotlin Map:mapOf()用法及代码示例
- Kotlin distinctBy用法及代码示例
- Kotlin digitToChar用法及代码示例
- Kotlin ifBlank用法及代码示例
- Kotlin all用法及代码示例
- Kotlin digitToIntOrNull用法及代码示例
- Kotlin dropLast用法及代码示例
- Kotlin dropLastWhile用法及代码示例
- Kotlin associateBy用法及代码示例
- Kotlin groupingBy用法及代码示例
- Kotlin groupBy用法及代码示例
- Kotlin getOrElse用法及代码示例
- Kotlin getOrPut用法及代码示例