diff options
author | Arnie97 <arnie97@gmail.com> | 2015-04-11 13:09:50 +0800 |
---|---|---|
committer | Arnie97 <arnie97@gmail.com> | 2015-04-11 13:09:50 +0800 |
commit | c7f085ee34ebce89e523b10a56f9f6d5b1e4cd3a (patch) | |
tree | 7739ad481e099b59dd0393c61e898c51c35f9356 /perl6.html.markdown | |
parent | c38d8d93135561e8c0afbe20a5b16b39917ee06c (diff) | |
parent | f0540b93b16311ca39cf4f0ad5a9abf8dc13f223 (diff) |
Merge pull request #1 from adambard/master
Fetch updates from upstream
Diffstat (limited to 'perl6.html.markdown')
-rw-r--r-- | perl6.html.markdown | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/perl6.html.markdown b/perl6.html.markdown index 85ab1d79..8404f9f8 100644 --- a/perl6.html.markdown +++ b/perl6.html.markdown @@ -253,7 +253,9 @@ given "foo bar" { when $_.chars > 50 { # smart matching anything with True (`$a ~~ True`) is True, # so you can also put "normal" conditionals. # This when is equivalent to this `if`: - # if ($_.chars > 50) ~~ True {...} + # if $_ ~~ ($_.chars > 50) {...} + # Which means: + # if $_.chars > 50 {...} say "Quite a long string !"; } default { # same as `when *` (using the Whatever Star) @@ -560,7 +562,7 @@ subset VeryBigInteger of Int where * > 500; multi sub sayit(Int $n) { # note the `multi` keyword here say "Number: $n"; } -multi sayit(Str $s) } # a multi is a `sub` by default +multi sayit(Str $s) { # a multi is a `sub` by default say "String: $s"; } sayit("foo"); # prints "String: foo" @@ -963,7 +965,7 @@ say join ',', gather if False { # But consider: constant thrice = gather for ^3 { say take $_ }; # Doesn't print anything # versus: -constant thrice = eager gather for ^3 { say take $_ }; #=> 0 1 2 3 4 +constant thrice = eager gather for ^3 { say take $_ }; #=> 0 1 2 # - `lazy` - Defer actual evaluation until value is fetched (forces lazy context) # Not yet implemented !! |