mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-26 09:21:00 +03:00
Merge pull request #1031 from brxfork/patch-1
Update perl6.html.markdown // when and smartmatch
This commit is contained in:
commit
218de8c34d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user