Skip to content

Commit 45635a0

Browse files
Merge pull request #907 from ahalbert/906
Fixed confusing wording in the state variables docs
2 parents cd879ef + a2c9940 commit 45635a0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

doc/Language/variables.pod6

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,6 @@ Therefore, the subroutine
591591
592592
say a for 1..6;
593593
594-
This works per "clone" of the containing code object, so:
595-
596-
({ state $i = 1; $i++.say; } xx 3).map: {$_(), $_()}; # says 1 then 2 thrice
597-
598-
Note that this is B<not> a thread-safe construct when the same clone of the same
599-
block is run by multiple threads. Also remember that methods only have one
600-
clone per class, not per object.
601-
602594
will continue to increment C<$l> and append it to C<@x> each time it is
603595
called. So it will output
604596
@@ -613,6 +605,15 @@ called. So it will output
613605
614606
=end code
615607
608+
This works per "clone" of the containing code object, as in this example:
609+
610+
({ state $i = 1; $i++.say; } xx 3).map: {$_(), $_()}; # says 1 then 2 thrice
611+
612+
Note that this is B<not> a thread-safe construct when the same clone of the same
613+
block is run by multiple threads. Also remember that methods only have one
614+
clone per class, not per object.
615+
616+
616617
As with C<my>, declaring multiple C<state> variables must be placed
617618
in parentheses and for declaring a single variable, parentheses may
618619
be omitted.

0 commit comments

Comments
 (0)