diff options
author | Patrick Sebastian Zimmermann <patrick@zakweb.de> | 2014-08-05 19:50:19 +0200 |
---|---|---|
committer | Patrick Sebastian Zimmermann <patrick@zakweb.de> | 2014-08-05 19:50:19 +0200 |
commit | 170de5223165b0f9aa763b171bed153c4073648d (patch) | |
tree | 3e1faa0a3befb1df3c8497cd55e376a03c9d0f56 | |
parent | 4541a0f450cb3ee29b4c11c727b1dc17e3f436ca (diff) |
Minor fixes to return values.
-rw-r--r-- | perl6.html.markdown | 10 |
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: |