Skip to content

Commit 235d479

Browse files
committed
brackets → curly braces, add example refs #2114
1 parent 6659b44 commit 235d479

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

doc/Language/traps.pod6

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ A L<C<Match> will be C<Nil>|https://docs.perl6.org/language/regexes#Literals> if
8282
8383
=head2 Beware of empty "blocks"
8484
85-
Brackets are used to declare blocks. However, empty brackets will
85+
Curly braces are used to declare blocks. However, empty curly braces will
8686
declare a hash.
8787
8888
=begin code
@@ -92,6 +92,12 @@ $ = {…} # Block
9292
$ = { } # Hash
9393
=end code
9494
95+
You can use the second form if you effectively want to declare an empty block:
96+
97+
my &does-nothing = {;};
98+
say does-nothing(33);# OUTPUT: «Nil␤»
99+
100+
95101
=head1 Objects
96102
97103
=head2 Assigning to attributes

0 commit comments

Comments
 (0)