summaryrefslogtreecommitdiffhomepage
path: root/perl6.html.markdown
diff options
context:
space:
mode:
authorEvgeniy Ginzburg <Nad.Oby@gmail.com>2014-08-06 23:45:44 +0300
committerEvgeniy Ginzburg <Nad.Oby@gmail.com>2014-08-06 23:45:44 +0300
commitcb3217fc35f3097c4be5b39fb36bd74b5e415f6c (patch)
treecedbb3d549ea8f810ab720b09f1c56ba6b89dc6e /perl6.html.markdown
parent7bcf65278c28cffd32ef051965c2e6401563acc9 (diff)
parent4349587ac4de7bc3436f68415bcf5bdfac260e5e (diff)
Merge https://github.com/adambard/learnxinyminutes-docs
Added two minor changes in integer division to make it clear
Diffstat (limited to 'perl6.html.markdown')
-rw-r--r--perl6.html.markdown10
1 files changed, 5 insertions, 5 deletions
diff --git a/perl6.html.markdown b/perl6.html.markdown
index 567c4629..92219708 100644
--- a/perl6.html.markdown
+++ b/perl6.html.markdown
@@ -92,7 +92,7 @@ sub as-many($head, *@rest) { # the `*@` slurpy will basically "take everything e
# but not *after*.
say @rest.join(' / ') ~ " !";
}
-say as-many('Happy', 'Happy', 'Birthday'); #=> Happy Birthday !
+say as-many('Happy', 'Happy', 'Birthday'); #=> Happy / Birthday !
# Note that the splat did not consume the parameter before.
## You can call a function with an array using the "argument list flattening" operator `|`
@@ -127,7 +127,7 @@ sub with-named($normal-arg, :$named) {
}
with-named(1, named => 6); #=> 7
# There's one gotcha to be aware of, here:
-# If you quote your key, Perl 6 won't be able to see it as compile time,
+# If you quote your key, Perl 6 won't be able to see it at compile time,
# and you'll have a single Pair object as a positional paramater.
with-named(2, :named(5)); #=> 7
@@ -171,9 +171,9 @@ named-def(def => 15); #=> 15
### Containers
# In Perl 6, values are actually stored in "containers".
-# the assignment operator asks the container on the left to store the value on its right
+# The assignment operator asks the container on the left to store the value on its right.
# When passed around, containers are marked as immutable. Which means that, in a function,
-# you'll get an error if you try to mutate one of your argument.
+# you'll get an error if you try to mutate one of your arguments.
# If you really need to, you can ask for a mutable container using `is rw` :
sub mutate($n is rw) {
$n++;
@@ -374,7 +374,7 @@ sub foo(@array [$fst, $snd]) {
say "My first is $fst, my second is $snd ! All in all, I'm @array[].";
# (^ remember the `[]` to interpolate the array)
}
-foo(@tail); #=> My first is 2, my second is 3 ! All in all, I'm 1 2
+foo(@tail); #=> My first is 2, my second is 3 ! All in all, I'm 2 3
# If you're not using the array itself, you can also keep it anonymous, much like a scalar: