@@ -70,13 +70,13 @@ Dave has won 2 matches and 6 sets
70
70
Charlie has won 1 matches and 4 sets
71
71
Beth has won 1 matches and 4 sets
72
72
73
- = head3 X < C < v6 > >
73
+ = head3 X < C < v6 > |v6 (Basics) >
74
74
75
75
Every Perl 6 program should begin with C < use v6; > . This line tells the compiler
76
76
which version of Perl the program expects. Should you accidentally run the file
77
77
with Perl 5, you'll get a helpful error message.
78
78
79
- = head3 X < C < statement > >
79
+ = head3 X < C < statement > |statement (Basics) >
80
80
81
81
A Perl 6 program consists of zero or more statements. A I < statement > ends with
82
82
a semicolon or a curly bracket at the end of a line:
@@ -93,7 +93,7 @@ block, it's visible throughout the remainder of the file (which would
93
93
effectively be the enclosing block). A block is any part of the code enclosed
94
94
between curly braces C < { } > .
95
95
96
- = head3 X < C < sigil > > and X < C < identifier > >
96
+ = head3 X < C < sigil > > and X < C < identifier > |identifier (Basics) >
97
97
98
98
A variable name begins with a I < sigil > , which is a non-alpha-numeric
99
99
symbol such as C < $ > , C < @ > , C < % > , or C < & > --or occasionally the double
@@ -132,7 +132,7 @@ it's the argument provided to C<open>.
132
132
my @names = $file.get.words;
133
133
= end code
134
134
135
- = head3 X < C < array > > , X < C < method > > and X < C < invocant > >
135
+ = head3 X < C < array > > , X < C < method > |method (Basics) > and X < C < invocant > |invocant (Basics) >
136
136
137
137
The right-hand side calls a I < method > --a named group of behavior-- named C < get >
138
138
on the filehandle stored in C < $file > . The C < get > method reads and returns
@@ -172,7 +172,7 @@ of these hashes are indexed by the player's name.
172
172
}
173
173
= end code
174
174
175
- = head3 X < C < for > > and X < C < block > >
175
+ = head3 X < C < for > |for (Basics) > and X < C < block > >
176
176
177
177
C < for > produces a loop that runs the I < block > delimited by curly brackets
178
178
once for each item of the list, setting the variable C < $line >
@@ -240,7 +240,7 @@ The C<+=> assignment operator is a shortcut for:
240
240
%sets{$p2} = %sets{$p2} + $r2;
241
241
= end code
242
242
243
- = head3 X < C < Any > > and X < C < += > >
243
+ = head3 X < C < Any > | Any (Basics) > and X < C < += > >
244
244
245
245
C < += $r1 > means I < increase the value in the variable on the left by $r1 > . In
246
246
the first iteration C < %sets{$p1} > is not yet set, so it defaults to a special
@@ -291,7 +291,7 @@ names. The C<sort> method's argument is a I<block> used to transform the array
291
291
elements (the names of players) to the data by which to sort. The array items
292
292
are passed in through the I < topic variable > C < $_ > .
293
293
294
- = head3 X < C < block > >
294
+ = head3 X < C < block > |block (Basics) >
295
295
296
296
You have seen blocks before: both the C < for > loop C << -> $line { ... } >> and
297
297
the C < if > statement worked on blocks. A block is a self-contained piece of
@@ -326,7 +326,7 @@ on the result of the second sort, and stores the final list in C<@sorted>.
326
326
}
327
327
= end code
328
328
329
- = head3 X < C < say > > , X < C < print > > and X < C < put > >
329
+ = head3 X < C < say > | say (Basics) > , X < C < print > | say (Basics) > and X < C < put > |put (Basics) >
330
330
331
331
To print out the players and their scores, the code loops over C < @sorted > ,
332
332
setting C < $n > to the name of each player in turn. Read this code as "For each
@@ -394,7 +394,7 @@ followed by a postcircumfix -- a bracketing pair that follows a
394
394
statement. It's also ok to have a method call between the variable name and
395
395
the postcircumfix.
396
396
397
- = head3 X < C < Zen slice > >
397
+ = head3 X < C < Zen slice > | Zen slice (Basics) >
398
398
399
399
= begin code
400
400
my @flavours = <vanilla peach>;
0 commit comments