Skip to content

Commit 800a5b9

Browse files
committed
Minor corrections and reflow
1 parent 2424e62 commit 800a5b9

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

doc/Language/variables.pod6

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Examples:
5050
my %hash = London => 'UK', Berlin => 'Germany';
5151
5252
X<|is (type of variable)>
53-
The type to which the variable will be bound, can be set with C<is> in the
53+
The type to which the variable will be bound can be set with C<is> in the
5454
declaration of the variable. Assuming we have a C<FailHash> class:
5555
5656
class FailHash is Hash {
@@ -68,7 +68,7 @@ declaration of the variable. Assuming we have a C<FailHash> class:
6868
One can then define a C<%h> variable using C<is>:
6969
7070
=for code :preamble<class FailHash {}>
71-
my %h is FailHash = oranges => "round", bananas => "bendy";
71+
my %h is FailHash = oranges => "round", bananas => "bendy";
7272
7373
And then run the following code:
7474
@@ -139,12 +139,17 @@ assignment expression is parsed as C<@array = (($num = 42), "str")>, because
139139
item assignment has tighter precedence than the comma. However, let's see what
140140
happens if the internal variable assignment is in a list context:
141141
142-
my ( @foo, $bar );
143-
@foo = ($bar) = 42, "str"; # list assignment for $bar: uses parentheses
144-
say @foo.perl; # OUTPUT: «[(42, "str"),]␤» (an Array)
145-
say $bar.perl; # OUTPUT: «$(42, "str")␤» (a List)#
142+
=for code
143+
my ( @foo, $bar );
144+
@foo = ($bar) = 42, "str"; # list assignment for $bar: uses parentheses
145+
say @foo.perl; # OUTPUT: «[(42, "str"),]␤» (an Array)
146+
say $bar.perl; # OUTPUT: «$(42, "str")␤» (a List)#
146147
147-
In this case, C<()> is the list contextualizer, putting the assignment to C<$bar> in a list context; C<$bar> then I<decides> to include all the items to the right hand side of the C<=> sign; this is still included in a list assignment to C<@foo>, which then becomes an array with a single element, a C<List>.
148+
In this case, C<()> is the list contextualizer, putting the assignment to
149+
C<$bar> in a list context; C<$bar> then I<decides> to include all the items to
150+
the right hand side of the C<=> sign; this is still included in a list
151+
assignment to C<@foo>, which then becomes an array with a single element, a
152+
C<List>.
148153
149154
See L<operators|/language/operators> for more details on precedence.
150155
@@ -166,8 +171,8 @@ you've defined it:
166171
θ = 3; # Dies with the error "Cannot modify an immutable Num"
167172
=end code
168173
169-
Sigilless variables do not enforce context, so they can be used to pass
170-
something on as-is:
174+
Sigilless variables do not enforce L<context|/language/contexts>, so they can be
175+
used to pass something on as-is:
171176
172177
sub logged(&f, |args) {
173178
say('Calling ' ~ &f.name ~ ' with arguments ' ~ args.perl);

0 commit comments

Comments
 (0)