类中函数模板 typeof_Julia中的typeof()函数

类中函数模板 typeof

Julia| typeof()函数 (Julia | typeof() function)

typeof() function is a library function in Julia programming language, it is used to get the concrete type of the given value or variable.

typeof()函数是Julia编程语言中的库函数,用于获取给定值或变量的具体类型。

Syntax:

句法:

    typeof(x)

Here, x is the value/variable whose data type to be found.

在此, x是要查找其数据类型的值/变量。

Example:

例:

    typeof(10)
    Int64

    x = 10
    typeof(x)
    Int64

    x = 'A'
    typeof(x)
    Char

    typeof(Int64)
    DataType

Program:

程序:

# Example of typeof() function in Julia

# type of values
println("typeof(0): ", typeof(0))
println("typeof(10): ", typeof(10))
println("typeof(-10): ", typeof(-10))
println("typeof(10.23): ", typeof(10.23))
println("typeof('A'): ", typeof('A'))
println("typeof(\"Hello\"): ", typeof("Hello"))
println()

# type of variables
a = 0
b = 10
c = -10
d = 10.23
e = 'A'
f = "Hello"

println("typeof(a): ", typeof(a))
println("typeof(b): ", typeof(b))
println("typeof(c): ", typeof(c))
println("typeof(d): ", typeof(d))
println("typeof(e): ", typeof(e))
println("typeof(f): ", typeof(f))
println()

# type of data type
println("typeof(Bool): ", typeof(Bool))
println("typeof(Int64): ", typeof(Int64))
println("typeof(Float64): ", typeof(Float64))
println("typeof(Char): ", typeof(Char))
println("typeof(String): ", typeof(String))
println()

Output

输出量

typeof(0): Int64
typeof(10): Int64
typeof(-10): Int64
typeof(10.23): Float64
typeof('A'): Char
typeof("Hello"): String

typeof(a): Int64
typeof(b): Int64
typeof(c): Int64
typeof(d): Float64
typeof(e): Char
typeof(f): String

typeof(Bool): DataType
typeof(Int64): DataType
typeof(Float64): DataType
typeof(Char): DataType
typeof(String): DataType

Reference: Julia Core.typeof()

参考: JuliaCore.typeof()

翻译自: https://www.includehelp.com/julia/typeof-function.aspx

类中函数模板 typeof

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值