Merge pull request #3559 from b-xor-a/master

[perl6/en] Fixed output
This commit is contained in:
Divay Prakash 2019-08-03 00:36:55 +05:30 committed by GitHub
commit 399d172155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,11 +247,12 @@ concat3(|@array); #=> a, b, c
## arguments. If you really need to, you can ask for a mutable container by
## using the `is rw` trait:
sub mutate( $n is rw ) {
$n++;
$n++; # postfix ++ operator increments its argument but returns its old value
}
my $m = 42;
mutate $m; #=> 43
mutate $m; # the value is incremented but the old value is returned
#=> 42
say $m; #=> 43
## This works because we are passing the container $m to the `mutate` sub.