Skip to content

Commit a47aced

Browse files
authored
Consistency
1 parent 51eb039 commit a47aced

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/Language/operators.pod6

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,30 +2281,32 @@ is not required for the very last routine/method).
22812281
<people of earth>; # (1) Start with the input
22822282
22832283
# Feed (left-to-right) with parentheses, read top-to-bottom
2284-
@result = (
2284+
my @result = (
22852285
<people of earth> # (1) Start with the input
22862286
==> map({ .tc }) # (2) Capitalize the words
22872287
==> grep /<[PE]>/ # (3) Look for P or E
22882288
==> sort # (4) Sort, result is <Earth People>
22892289
);
22902290
22912291
# For illustration, method chaining equivalent, read top-to-bottom
2292-
@result =
2292+
my @result =
22932293
<people of earth> # (1) Start with the input
22942294
.map({ .tc }) # (2) Capitalize the words
22952295
.grep(/<[PE]>/) # (3) Look for P or E
22962296
.sort; # (4) Sort, result is <Earth People>
22972297
22982298
# To assign without the need of parentheses use another feed operator
2299-
<people of earth>
2299+
my @result =
2300+
<people of earth>
23002301
==> map({ .tc })
23012302
==> grep /<[PE]>/
23022303
==> sort()
23032304
==> @result;
23042305
23052306
# It can be useful to capture a partial result, however, unlike
23062307
# the leftward feed operator, it does require parentheses or a semicolon
2307-
<people of earth>
2308+
my @result =
2309+
<people of earth>
23082310
==> map({ .tc })
23092311
==> my @caps; @caps # also could wrap in parentheses instead
23102312
==> grep /<[PE]>/

0 commit comments

Comments
 (0)