Skip to content

Commit

Permalink
doc : may return UnitRange, StepRange, & StepRangeLen (#47670)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Stock <42280794+sostock@users.noreply.github.com>
  • Loading branch information
udohjeremiah and sostock authored Feb 10, 2023
1 parent a647575 commit 3283e20
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ _colon(::Any, ::Any, start::T, step, stop::T) where {T} =
(:)(start, [step], stop)
Range operator. `a:b` constructs a range from `a` to `b` with a step size
of 1 (often a [`UnitRange`](@ref)), and `a:s:b` is similar but uses a step
size of `s` (a [`StepRange`](@ref) or [`StepRangeLen`](@ref)).
See also [`range`](@ref) for more control.
equal to 1, which produces:
* a [`UnitRange`](@ref) when `a` and `b` are integers, or
* a [`StepRange`](@ref) when `a` and `b` are characters, or
* a [`StepRangeLen`](@ref) when `a` and/or `b` are floating-point.
`a:s:b` is similar but uses a step size of `s` (a [`StepRange`](@ref) or
[`StepRangeLen`](@ref)). See also [`range`](@ref) for more control.
The operator `:` is also used in indexing to select whole dimensions, e.g. in `A[:, 1]`.
Expand Down Expand Up @@ -469,9 +474,11 @@ A range `r` where `r[i]` produces values of type `T` (in the first
form, `T` is deduced automatically), parameterized by a `ref`erence
value, a `step`, and the `len`gth. By default `ref` is the starting
value `r[1]`, but alternatively you can supply it as the value of
`r[offset]` for some other index `1 <= offset <= len`. In conjunction
with `TwicePrecision` this can be used to implement ranges that are
free of roundoff error.
`r[offset]` for some other index `1 <= offset <= len`. The syntax `a:b`
or `a:b:c`, where any of `a`, `b`, or `c` are floating-point numbers, creates a
`StepRangeLen`.
In conjunction with `TwicePrecision` this can be used to implement ranges that
are free of roundoff error.
!!! compat "Julia 1.7"
The 4th type parameter `L` requires at least Julia 1.7.
Expand Down

0 comments on commit 3283e20

Please sign in to comment.