Skip to content

Commit 0a00934

Browse files
committed
Adds examples of min working on Hashes #2632
1 parent 423c94b commit 0a00934

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/Type/Any.pod6

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ Defined as:
554554
multi sub min(+args)
555555
556556
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically
557-
smallest element. In C<sub> form, the invocant is passed as an argument.
557+
smallest element; in the case of C<Hash>es, it returns the C<Pair> with the
558+
lowest value. In C<sub> form, the invocant is passed as an argument.
558559
559560
If a L<Callable|/type/Callable> positional argument is provided, each value is
560561
passed into the filter, and its return value is compared instead of the original
@@ -564,6 +565,8 @@ value. The original value is still the one returned from C<min>.
564565
say (1,7,3).min({1/$_}); # OUTPUT:«7␤»
565566
say min(1,7,3); # OUTPUT: «1␤»
566567
say min(1,7,3,:by( { 1/$_ } )); # OUTPUT: «7␤»
568+
min( %(a => 3, b=> 7 ) ).say ; # OUTPUT: «a => 3␤»
569+
567570
568571
=head2 method max
569572

0 commit comments

Comments
 (0)