super
super(T::DataType)
Return the supertype of DataType T
.
Examples
# Example 1: Find the supertype of a specific DataType
julia> supertype(Int64)
Signed
# Example 2: Find the supertype of a custom defined type
julia> struct MyType end
julia> supertype(MyType)
Any
# Example 3: Use in a function to access the supertype
julia> function print_supertype(T)
println(supertype(T))
end
julia> print_supertype(Float32)
AbstractFloat
Common mistake example:
julia> supertype(42)
ERROR: TypeError: in supertype, expected Type, got a value of type Int64
In this example, the supertype
function expects a DataType
as an argument, but an Int64
value is provided instead. Make sure to pass a DataType
to the supertype
function.
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.