Thursday 14 January 2016

Julia: get the type of the variable


By using ‘typeof(variableName)’ function, you can get the type of the variable. Based on the value assigned to a variable, Julia infer the type.
julia> a=10
10

julia> typeof(a)
Int64

julia> a="Hello"
"Hello"

julia> typeof(a)
ASCIIString

julia> a=true
true

julia> typeof(a)
Bool

julia> a=123.321
123.321

julia> typeof(a)
Float64


Previous                                                 Next                                                 Home

No comments:

Post a Comment