julia在mac环境变量_在Julia中确定值/变量的类型

julia在mac环境变量

To determine the type of value, variable – we use typeof() function, it accepts a value or a variable or a data type itself and returns the concrete type of the given parameter.

确定值的类型,变量 –我们使用typeof()函数 ,它接受值或变量或数据类型本身,并返回给定参数的具体类型。

Example 1: Determining the type of values

示例1:确定值的类型

# Julia | Determining the type of values

println("typeof(0): ", typeof(0))
println("typeof(-0): ", typeof(-0))
println("typeof(0.0): ", typeof(0.0))
println("typeof(-0.0): ", typeof(-0.0))
println("typeof(10): ", typeof(10))
println("typeof(10000): ", typeof(10000))
println("typeof(123.456): ", typeof(123.456))
println("typeof('X'): ", typeof('X'))
println("typeof(\"Hello\"): ", typeof("Hello"))

Output

输出量

typeof(0): Int64
typeof(-0): Int64
typeof(0.0): Float64
typeof(-0.0): Float64
typeof(10): Int64
typeof(10000): Int64
typeof(123.456): Float64
typeof('X'): Char
typeof("Hello"): String

Example 2: Determining the type of variables

示例2:确定变量的类型

# Julia | Determining the type of variables

a = 0
b = -0
c = 0.0
d = -0.0
e = 10
f = 10000
g = 123.456
h = 'X'
i = "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("typeof(g): ", typeof(g))
println("typeof(h): ", typeof(h))
println("typeof(i): ", typeof(i))

Output

输出量

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

Example 3: Determining the type of datatypes

示例3:确定数据类型的类型

# Julia | Determining the type of datatypes

println("typeof(Bool): ", typeof(Bool))
println("typeof(Char): ", typeof(Char))
println("typeof(Int32): ", typeof(Int32))
println("typeof(Float64): ", typeof(Float64))
println("typeof(String): ", typeof(String))

Output

输出量

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


翻译自: https://www.includehelp.com/julia/determine-the-type-of-a-value-variable.aspx

julia在mac环境变量

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值