Skip to content

Commit bbec26b

Browse files
committed
Added comment syntax on 101 page.
I think it's handy to make that easier to find in the documentation.
1 parent ca2534f commit bbec26b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

doc/Language/101-basics.pod6

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ Here's one way to solve that problem in Perl 6:
2929
=begin code :solo
3030
use v6;
3131
32-
my $file = open 'scores.txt';
32+
# Single line comments like this one start with '#'.
33+
my $file = open 'scores.txt'; # Comments can also follow code on a line.
3334
my @names = $file.get.words;
3435
3536
my %matches;
3637
my %sets;
3738
39+
#`( Multiple line comments
40+
are denoted by a #, then `, then one of {,[, or (
41+
and closed by the corresponding },], and ).
42+
Nested pairs of brackets and braces are matched, so
43+
something like this () will not end the comment.
44+
In this case, closed by: )
3845
for $file.lines -> $line {
3946
next unless $line; # ignore any empty lines
4047
@@ -52,6 +59,9 @@ for $file.lines -> $line {
5259
}
5360
}
5461
62+
#`[
63+
This is another multi-line comment. ]
64+
#`{ So is this, though it's not actually multi-line. }
5565
my @sorted = @names.sort({ %sets{$_} }).sort({ %matches{$_} }).reverse;
5666
5767
for @sorted -> $n {

0 commit comments

Comments
 (0)