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

相关方法

相关推荐
码农coding2 小时前
android12 systemUI 之锁屏
android
圆山猫2 小时前
[Virtualization](三):RISC-V H-extension 与 Guest 执行模式
android·java·risc-v
爱笑鱼2 小时前
Binder(七):getCallingUid() 读到的是谁?clearCallingIdentity() 又清掉了什么?
android
2501_915909068 小时前
iOS 应用反调试技详解术 检测调试器的原理与防护实践
android·ios·小程序·https·uni-app·iphone·webview
Lvan的前端笔记8 小时前
AndroidX 完全入门指南
android·androidx
帅次9 小时前
Android 应用高级面试:Window 近1年高频追问 18 题
android·面试·职场和发展
总捣什么乱19 小时前
MySQL MySQL是怎么保证主备一致的?
android·mysql·adb
zzm62810 小时前
精读 HinDroid:基于异构信息网络的安卓恶意软件检测
android
weixin_4407841110 小时前
Android基础知识汇总
android·java·android studio
sbjdhjd11 小时前
安全初级 | Upload 文件上传漏洞实操
android·经验分享·安全·网络安全·开源·php·apache