The
Python
Output:
Python
Output:
typeof() is an inbuilt function in julia which is used to return the concrete type of the specified elements.
Syntax: typeof(x) Parameters:Example 1:Returns: It returns the concrete type of the specified elements.
- x: Specified element.
# Julia program to illustrate
# the use of typeof() method
# Getting the concrete type of
# the specified elements.
a = 1//2;
b = 1 / 2;
c = 7 % 2;
d = 2;
println(typeof(a))
println(typeof(b))
println(typeof(c))
println(typeof(d))
Rational{Int64}
Float64
Int64
Int64
Example 2:
# Julia program to illustrate
# the use of typeof() method
# Getting the concrete type of
# the specified elements.
a = [1, 2, 3, 4];
b = [1 2; 3 4];
c = [1 2; 3.5 4];
d = [1 2; 3 4;5 4];
println(typeof(a))
println(typeof(b))
println(typeof(c))
println(typeof(d))
Array{Int64, 1}
Array{Int64, 2}
Array{Float64, 2}
Array{Int64, 2}