From 29d5158d27ddc3983ae2e373c4cd05569b9ead6c Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick <23kilpatrick23@gmail.com> Date: Thu, 15 Apr 2021 13:13:33 -0700 Subject: [PATCH] Add docstring example to VecOrMat (#38253) Co-authored-by: kimikage --- base/array.jl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/base/array.jl b/base/array.jl index afaa3b5f19d6b..7fd3ea8fb0bc2 100644 --- a/base/array.jl +++ b/base/array.jl @@ -64,10 +64,23 @@ Two-dimensional dense array with elements of type `T`, often used to represent a mathematical matrix. Alias for [`Array{T,2}`](@ref). """ const Matrix{T} = Array{T,2} + """ VecOrMat{T} -Union type of [`Vector{T}`](@ref) and [`Matrix{T}`](@ref). +Union type of [`Vector{T}`](@ref) and [`Matrix{T}`](@ref) which allows functions to accept either a Matrix or a Vector. + +# Examples +```jldoctest +julia> Vector{Float64} <: VecOrMat{Float64} +true + +julia> Matrix{Float64} <: VecOrMat{Float64} +true + +julia> Array{Float64, 3} <: VecOrMat{Float64} +false +``` """ const VecOrMat{T} = Union{Vector{T}, Matrix{T}}