Skip to content

Commit 29d5158

Browse files
Add docstring example to VecOrMat (#38253)
Co-authored-by: kimikage <[email protected]>
1 parent ed7b069 commit 29d5158

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

base/array.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,23 @@ Two-dimensional dense array with elements of type `T`, often used to represent
6464
a mathematical matrix. Alias for [`Array{T,2}`](@ref).
6565
"""
6666
const Matrix{T} = Array{T,2}
67+
6768
"""
6869
VecOrMat{T}
6970
70-
Union type of [`Vector{T}`](@ref) and [`Matrix{T}`](@ref).
71+
Union type of [`Vector{T}`](@ref) and [`Matrix{T}`](@ref) which allows functions to accept either a Matrix or a Vector.
72+
73+
# Examples
74+
```jldoctest
75+
julia> Vector{Float64} <: VecOrMat{Float64}
76+
true
77+
78+
julia> Matrix{Float64} <: VecOrMat{Float64}
79+
true
80+
81+
julia> Array{Float64, 3} <: VecOrMat{Float64}
82+
false
83+
```
7184
"""
7285
const VecOrMat{T} = Union{Vector{T}, Matrix{T}}
7386

0 commit comments

Comments
 (0)