Skip to content

Commit 9851aab

Browse files
0rircoke
authored andcommitted
Add info to 5to6-perlfunc.rakudoc at each HASH
Mentioning that there are Pair objects, so more possibilities, and specifically `.pairs` and `.antipairs`.
1 parent a215506 commit 9851aab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/Language/5to6-perlfunc.rakudoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,12 @@ According to S29, C<dump> has been... dumped.
431431

432432
=item each HASH
433433

434-
There is no exact equivalent, but you can use C<%hash.kv> which
435-
returns a list of keys and values. For example:
434+
There is no exact equivalent, because in Raku Hashes are composed of Pair objects.
435+
You can use C<%hash.kv> which
436+
returns a list of keys and values. example:
436437
C«for %hash.kv -> $k, $v { say "$k: $v" }».
438+
However Raku offers more possibilities, C<%hash.pairs> gives you each Pair object as
439+
as an entity, and C<%hash.antipairs> does the same with the keys and values reversed.
437440

438441
Incidentally, what we have there with the C«->» is called a pointy
439442
block and, though there are a number of examples in the documentation,

0 commit comments

Comments
 (0)