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 | Perl 6 today | #63 |
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 © 2009 http://www.pmichaud.com/2009/pres/ |