summaryrefslogtreecommitdiffhomepage
path: root/perl6.html.markdown
diff options
context:
space:
mode:
authorDimitri Kokkonis <kokkonisd@gmail.com>2019-08-06 12:40:31 +0200
committerGitHub <noreply@github.com>2019-08-06 12:40:31 +0200
commit922fc494bcce6cb53d80a5c2c9c039a480c82c1f (patch)
treea62b6e194db73630bfed43301b1c130d52f9dbba /perl6.html.markdown
parent5710394756a426255d2dc81d2d342e9786ac2c1b (diff)
parent2f0b904f6ffe68d15fedf7e50a3a64e1a47a9145 (diff)
Merge pull request #1 from adambard/master
Update fork
Diffstat (limited to 'perl6.html.markdown')
-rw-r--r--perl6.html.markdown5
1 files changed, 3 insertions, 2 deletions
diff --git a/perl6.html.markdown b/perl6.html.markdown
index cb64b646..6b0df0d4 100644
--- a/perl6.html.markdown
+++ b/perl6.html.markdown
@@ -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.