@@ -62,19 +62,19 @@ though you can't leave out any of the remaining whitespace.
62
62
= head2 X < Unspace|syntax,\ >
63
63
X < |syntax,Unspace >
64
64
65
- In many places where the compiler would not allow a space you can use any
66
- whitespace that is quoted with a backslash. Unspaces in tokens are not
67
- supported. Newlines that are unspaced still count when the compiler produces
68
- line numbers. Use cases for unspace are separation of postfix operators and
69
- routine argument lists.
65
+ In many places where the compiler would not allow a space you can use
66
+ any whitespace that is quoted with a backslash. Unspaces in tokens are
67
+ not supported. Newlines that are unspaced still count when the compiler
68
+ produces line numbers. Use cases for unspace are separation of postfix
69
+ operators and routine argument lists.
70
70
71
71
sub alignment(+@l) { +@l };
72
72
sub long-name-alignment(+@l) { +@l };
73
73
alignment\ (1,2,3,4).say;
74
74
long-name-alignment(3,5)\ .say;
75
75
say Inf+Inf\i;
76
76
77
- = head2 Separating Statements with Semicolons
77
+ = head2 Separating statements with semicolons
78
78
79
79
A Perl 6 program is a list of statements, separated by semicolons C < ; > .
80
80
@@ -83,8 +83,8 @@ say "Hello";
83
83
say "world";
84
84
= end code
85
85
86
- A semicolon after the final statement (or after the final statement inside a
87
- block) is optional.
86
+ A semicolon after the final statement (or after the final statement
87
+ inside a block) is optional.
88
88
89
89
= begin code
90
90
say "Hello";
@@ -98,39 +98,39 @@ if True {
98
98
say "world"
99
99
= end code
100
100
101
- = head2 Implied Separator Rule (for statements ending in blocks)
101
+ = head2 Implied separator rule (for statements ending in blocks)
102
102
103
- Complete statements ending in bare blocks can omit the trailing semicolon, if no
104
- additional statements on the same line follow the block's closing curly
105
- brace C < } > . This is called the "implied separator rule". For example, you
106
- don't need to write a semicolon after an C < if > statement block as seen above, and
107
- below.
103
+ Complete statements ending in bare blocks can omit the trailing
104
+ semicolon, if no additional statements on the same line follow the
105
+ block's closing curly brace C < } > . This is called the "implied separator
106
+ rule". For example, you don't need to write a semicolon after an C < if >
107
+ statement block as seen above, and below.
108
108
109
109
= begin code
110
110
if True { say "Hello" }
111
111
say "world";
112
112
= end code
113
113
114
- However, semicolons are required to separate a block from trailing statements in
115
- the same line.
114
+ However, semicolons are required to separate a block from trailing
115
+ statements in the same line.
116
116
117
117
= begin code
118
118
if True { say "Hello" }; say "world";
119
119
# ^^^ this ; is required
120
120
= end code
121
121
122
- This implied statement separator rule applies in other ways, besides control
123
- statements, that could end with a bare block. For example, in combination with
124
- the colon C < : > syntax for method calls.
122
+ This implied statement separator rule applies in other ways, besides
123
+ control statements, that could end with a bare block. For example, in
124
+ combination with the colon C < : > syntax for method calls.
125
125
126
126
= begin code
127
127
my @names = <Foo Bar Baz>;
128
128
my @upper-case-names = @names.map: { .uc } # OUTPUT: [FOO BAR BAZ]
129
129
= end code
130
130
131
- For a series of blocks that are part of the same C < if > /C < elsif > /C < else > (or similar)
132
- construct, the implied separator rule only applies at the end of the last block of that series.
133
- These three are equivalent:
131
+ For a series of blocks that are part of the same C < if > /C < elsif > /C < else >
132
+ (or similar) construct, the implied separator rule only applies at the
133
+ end of the last block of that series. These three are equivalent:
134
134
135
135
= begin code
136
136
if True { say "Hello" } else { say "Goodbye" }; say "world";
@@ -193,9 +193,11 @@ say "No more";
193
193
= end code
194
194
195
195
Brackets inside the comment can be nested, so in C < #`{ a { b } c } > , the
196
- comment goes until the very end of the string. You may also use more complex
197
- brackets, such as C < #`{{ double-curly-brace }} > , which might help disambiguate
198
- from nested brackets. You can embed these comments in expressions, as long as you don't insert them in the middle of keywords or identifiers.
196
+ comment goes until the very end of the string. You may also use more
197
+ complex brackets, such as C < #`{{ double-curly-brace }} > , which might
198
+ help disambiguate from nested brackets. You can embed these comments in
199
+ expressions, as long as you don't insert them in the middle of keywords
200
+ or identifiers.
199
201
200
202
= head3 Pod comments
201
203
@@ -372,18 +374,19 @@ variables:
372
374
373
375
= head2 Packages and Qualified Names
374
376
375
- Named entities, such as variables, constants, classes, modules, subs, etc, are
376
- part of a namespace. Nested parts of a name use C < :: > to separate the
377
- hierarchy. Some examples:
377
+ Named entities, such as variables, constants, classes, modules or subs,
378
+ are part of a namespace. Nested parts of a name use C < :: > to separate
379
+ the hierarchy. Some examples:
378
380
379
- = begin code :skip-test
380
- $foo # simple identifiers
381
- $Foo::Bar::baz # compound identifiers separated by ::
382
- $Foo::($bar)::baz # compound identifiers that perform interpolations
383
- Foo::Bar::bob(23) # function invocation given qualified name
384
- = end code
381
+ = begin code :skip-test
382
+ $foo # simple identifiers
383
+ $Foo::Bar::baz # compound identifiers separated by ::
384
+ $Foo::($bar)::baz # compound identifiers that perform interpolations
385
+ Foo::Bar::bob(23) # function invocation given qualified name
386
+ = end code
385
387
386
- See the L < documentation on packages|/language/packages > for more details.
388
+ See the L < documentation on packages|/language/packages > for more
389
+ details.
387
390
388
391
389
392
= head2 Literals
0 commit comments