Cursus Raku / Elementa / Fundamenta functionum / Plus de functionibus / Typis parametra
Quiz — Typis parametra
1
Given the function:
sub f(Rat $x) {
say 2 * $x;
}Which calls are correct?
| 0 | f(3); | Etiamsi 3 in continens Rat convenire potest, vocatio falsa est quia 3 est Int, non Rat. |
| 1 | f(3.5); | |
| 0 | f(3e0); | |
| 0 | f('3'); | |
| 1 | f(<4/5>); | Hoc est numerus Rat. |
2
Given the function:
sub g(Int $a, Str $b) {
say "Integer $a, string $b";
}Which calls are correct?
| 0 | g(10, 20); | |
| 0 | g('10', 20); | Etiamsi utrumque argumentum converti potest, Raku exactum genus postulat. |
| 1 | g(10, '20'); | |
| 0 | g('10, 20'); | Una stringa praeterita. |
| 0 | g('10', '20'); |