Skip to content

Commit

Permalink
Make the prevind/nextind docstrings generic
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWrigley committed Jan 28, 2024
1 parent e9dde78 commit 648b68d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,14 @@ String
valtype(A::Type{<:AbstractArray}) = eltype(A)

"""
prevind(::AbstractArray, i)
prevind(A, i)
Return the index before `i` in `A`. The returned index is often equivalent to `i - 1` for an integer `i`. This
function can be useful for generic code.
Return the index before `i` in `A`. The returned index is often equivalent to `i
- 1` for an integer `i`. This function can be useful for generic code.
!!! warning
The returned index might be out of bounds. Consider using [`checkbounds`](@ref).
The returned index might be out of bounds. Consider using
[`checkbounds`](@ref).
See also: [`nextind`](@ref).
Expand All @@ -243,14 +244,14 @@ CartesianIndex(2, 0)
prevind(::AbstractArray, i::Integer) = Int(i)-1

"""
nextind(::AbstractArray, i)
nextind(A, i)
Return the index after `i`, e.g. equivalent to `i + 1` for an integer `i`. This
function can be useful for generic code that operates on both arrays and
strings, since string indices may not be consecutive.
Return the index after `i` in `A`. The returned index is often equivalent to `i
+ 1` for an integer `i`. This function can be useful for generic code.
!!! warning
The returned index might be out of bounds. Consider using [`checkbounds`](@ref).
The returned index might be out of bounds. Consider using
[`checkbounds`](@ref).
See also: [`prevind`](@ref).
Expand Down

0 comments on commit 648b68d

Please sign in to comment.