We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c91b2de commit d0297beCopy full SHA for d0297be
doc/Type/Signature.pod6
@@ -714,6 +714,14 @@ While the destructuring of a hash is its pairs:
714
$x andthen $y andthen $z andthen True
715
}
716
717
+Pointy loops can also destructure hashes, allowing assignment to variables:
718
+
719
+ my %hhgttu = (:40life, :41universe, :42everything);
720
+ for %hhgttu -> (:$key, :$value) {
721
+ say "$key → $value";
722
+ }
723
+ # OUTPUT: «universe → 41life → 40everything → 42»
724
725
In general, an object is destructured based on its attributes. A common idiom
726
is to unpack a L<C<Pair>>'s key and value in a for loop:
727
0 commit comments