Skip to content

Commit c019132

Browse files
authored
Update documentation for min and max with missing values (#48906)
With respect to #25403 , `min` and `max` methods are supposed to return "missing" whenever we pass "missing" value as one of the arguments, this PR updates the inline documentation to reflect the same.
1 parent 405ce11 commit c019132

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

base/operators.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,27 +464,35 @@ cmp(x::Integer, y::Integer) = ifelse(isless(x, y), -1, ifelse(isless(y, x), 1, 0
464464
"""
465465
max(x, y, ...)
466466
467-
Return the maximum of the arguments (with respect to [`isless`](@ref)). See also the [`maximum`](@ref) function
468-
to take the maximum element from a collection.
467+
Return the maximum of the arguments, with respect to [`isless`](@ref).
468+
If any of the arguments is [`missing`](@ref), return `missing`.
469+
See also the [`maximum`](@ref) function to take the maximum element from a collection.
469470
470471
# Examples
471472
```jldoctest
472473
julia> max(2, 5, 1)
473474
5
475+
476+
julia> max(5, missing, 6)
477+
missing
474478
```
475479
"""
476480
max(x, y) = ifelse(isless(y, x), x, y)
477481

478482
"""
479483
min(x, y, ...)
480484
481-
Return the minimum of the arguments (with respect to [`isless`](@ref)). See also the [`minimum`](@ref) function
482-
to take the minimum element from a collection.
485+
Return the minimum of the arguments, with respect to [`isless`](@ref).
486+
If any of the arguments is [`missing`](@ref), return `missing`.
487+
See also the [`minimum`](@ref) function to take the minimum element from a collection.
483488
484489
# Examples
485490
```jldoctest
486491
julia> min(2, 5, 1)
487492
1
493+
494+
julia> min(4, missing, 6)
495+
missing
488496
```
489497
"""
490498
min(x,y) = ifelse(isless(y, x), y, x)

0 commit comments

Comments
 (0)