Skip to content

Commit 888adbc

Browse files
fredrikekreKristofferC
authored andcommitted
document AbstractArray and doctest for Array (#22052)
1 parent 215adb2 commit 888adbc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

base/abstractarray.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## Basic functions ##
44

5+
"""
6+
AbstractArray{T, N}
7+
8+
Abstract array supertype which arrays inherit from.
9+
"""
10+
AbstractArray
11+
512
"""
613
size(A::AbstractArray, [dim...])
714

base/array.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,22 @@ import Core: arraysize, arrayset, arrayref
5353
Array{T,N}(dims)
5454
5555
Construct an uninitialized `N`-dimensional dense array with element type `T`,
56-
where `N` is determined from the length or number of `dims`. `dims` may
56+
where `N` is determined from the length or number of `dims`. `dims` may
5757
be a tuple or a series of integer arguments corresponding to the lengths in each dimension.
5858
If the rank `N` is supplied explicitly as in `Array{T,N}(dims)`, then it must
5959
match the length or number of `dims`.
60+
61+
# Example
62+
63+
```jldoctest
64+
julia> A = Array{Float64, 2}(2, 2);
65+
66+
julia> ndims(A)
67+
2
68+
69+
julia> eltype(A)
70+
Float64
71+
```
6072
"""
6173
Array
6274

0 commit comments

Comments
 (0)