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环境变量