# subtypes

subtypes(T::DataType)

Return a list of immediate subtypes of DataType `T`. Note that all currently loaded subtypes are included, including those not visible in the current module.

## Examples

``````julia> subtypes(Number)
2-element Array{Any,1}:
Complex{T<:Real}
Real``````
``````julia> subtypes(Int)
0-element Array{Any,1}``````

Here are some examples of how to use the `subtypes` function:

1. Get subtypes of `Number`:

``````julia> subtypes(Number)
4-element Array{Any,1}:
Complex
Real
Integer
AbstractFloat``````

This example returns a list of subtypes of the `Number` abstract type, including `Complex`, `Real`, `Integer`, and `AbstractFloat`.

2. Find subtypes of a custom defined type:

``````julia> abstract type Animal end
julia> struct Dog <: Animal end
julia> struct Cat <: Animal end
julia> struct Bird <: Animal end

julia> subtypes(Animal)
3-element Array{Any,1}:
Dog
Cat
Bird``````

Here, we define an abstract type `Animal`, and three subtypes `Dog`, `Cat`, and `Bird`. Using `subtypes(Animal)` returns a list of these subtypes.

3. Get subtypes from a specific module:

``````julia> using LinearAlgebra

julia> subtypes(AbstractMatrix)
4-element Array{Any,1}:
Bidiagonal
SymTridiagonal
Tridiagonal
Diagonal``````

In this example, we load the `LinearAlgebra` module and find the subtypes of the `AbstractMatrix` type from that module.

It's important to note that the returned list includes all currently loaded subtypes, even those not visible in the current module.

Please note that the function `subtypes` returns an array of type `Any`, as the subtypes can be any type that is a subtype of the provided `DataType`.