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

相关方法

相关推荐
针叶8 小时前
Google Play加固保护导致的崩溃
android·安全·google
执明wa10 小时前
Android Studio 项目目录结构全方位详解
android·ide·android studio
__Witheart__11 小时前
Android编译错误:Soong阶段因缺失res目录导致panic (Iwlan模块)
android
酿情师12 小时前
逆向exe文件:CRT 初始化流程详细分析
android·软件构建·逆向·re·crt‘
问心无愧051314 小时前
ctf show web入门71
android·前端·笔记
夜勤月14 小时前
AQS 与 ThreadPoolExecutor 深度拆解:JDK 高并发底层设计精髓
android·java·开发语言
Yeyu14 小时前
Android 卡顿诊断 SDK:从痛点出发的设计思考
android
Refrain_zc14 小时前
Android 音视频通话核心二 —— 视频编码详解记录
kotlin
上天_去_做颗惺星 EVE_BLUE15 小时前
Ubuntu Android 虚拟机安装使用教程
android·linux·测试工具·ubuntu·安卓
我命由我1234515 小时前
Android 开发问题:Could not find com.github.PicnicSupermarket:FingerPaintView:1.2.
android·github·android studio·安卓·android jetpack·android-studio·android runtime