Typed parameters
Types in signatures constrain the types of arguments to be passed
sub curse(Str $thing) {
say "$thing, you are cursed";
}
curse("black hole"); # OK
curse(42); # Type check failure
| Perl 6 | Cool Perl 6 | #90 |
Types in signatures constrain the types of arguments to be passed
sub curse(Str $thing) {
say "$thing, you are cursed";
}
curse("black hole"); # OK
curse(42); # Type check failure
|
Copyright © 2010 http://www.pmichaud.com/2010/pres/ |