-
-
Save zoffixznet/a79f2825a67338f04cfbbd5a7897124d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Narrow { } | |
class Middle is Narrow { } | |
class Wide is Middle { } | |
multi foo (Narrow $v) { say "Narrow ", $v; $v.^name.uc } | |
multi foo (Middle $v) { say "Middle ", $v; $v.^name.uc } | |
multi foo (Wide $v) { say "Wide ", $v; nextwith 41; $v.^name.uc } | |
multi foo (Any $v where .is-prime) { say "Prime ", $v; $v.^name.uc } | |
multi foo (Any $v where not .is-prime) { say "Non-Prime ", $v; $v.^name.uc } | |
foo Wide; # OUTPUT: Wide (Wide) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment