Home » 
        Julia
    
    
    typeof() function in Julia
    
    
    
           
        Julia | typeof() function: In this tutorial, we are going to learn about the typeof() function with example in Julia programming language.
        Submitted by IncludeHelp, on March 30, 2020
    
    
    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. 
Syntax:
    typeof(x)
    
    Here, x is the value/variable whose data type to be found.
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()
    
    
  
    Advertisement
    
    
    
  
  
    Advertisement