From c3afeeec5c080fd644b7082b9b1c4fb5879b5964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Tue, 27 Feb 2024 17:46:33 +0800 Subject: [PATCH] Update data-type.md --- docs/uts/data-type.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/uts/data-type.md b/docs/uts/data-type.md index 3cbea265..db7cd255 100644 --- a/docs/uts/data-type.md +++ b/docs/uts/data-type.md @@ -165,6 +165,10 @@ let b:Int = 4 let c:Double = a * 1.0 / b //Float let d2 = (100 as Number).toFloat() +// 静态赋值给kotlin.Byte,变量范围为 -128至+127 如果超出此范围会报错 +let e:Byte = 127 +// 使用toByte 方法转换,超出-128至+127会自动溢出,不会报错 +let e2 = (225 as Number).toByte() // #endif ``` -- GitLab