From bdb7dc663eea32b5ce55d25f322c23953cc5a4cd Mon Sep 17 00:00:00 2001 From: lizhongyi Date: Thu, 3 Aug 2023 15:50:24 +0800 Subject: [PATCH] docs 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 21a7efe52..87ebde620 100644 --- a/docs/uts/data-type.md +++ b/docs/uts/data-type.md @@ -133,6 +133,10 @@ num.toInt() //将number 变量 num 转换为 Int 类型 num.toFloat() //将number 变量 num 转换为 float 类型 num.toInt64() // 将number 变量 num 转换为 Int64 类型 +// 特定类型转成number +let f: Float = 5.0 +let n = Number(f) + // 特定类型转成其他的特定类型 let a:Int = 3 let b = new Double(a) // 将整型变量 a 转换为 Double 类型 -- GitLab