Kotlin Byte.inc用法及代码示例

本文方法及代码示例基于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

相关方法

相关推荐
CHINAHEAO9 分钟前
Bagisto单独将后台设置成中文
android
E***U94527 分钟前
React Native开发
android·react native·react.js
4***99741 小时前
Kotlin序列处理
android·开发语言·kotlin
t***D2641 小时前
Kotlin在服务端开发中的生态建设
android·开发语言·kotlin
玲珑Felone2 小时前
flutter 状态管理--InheritedWidget、Provider原理解析
android·flutter·ios
BoomHe2 小时前
车载应用配置系统签名
android·android studio
路人甲ing..4 小时前
用 Android Studio 自带的模拟 Android Emulator 调试
android·java·ide·ubuntu·kotlin·android studio
路人甲ing..4 小时前
Android Studio 模拟器报错 The emulator process for AVD xxxxx has terminated.
android·java·ide·kotlin·android studio
弥巷4 小时前
【Android】 View事件分发机制源码分析
android·java
wanna5 小时前
安卓自学小笔记第一弹
android·笔记