Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub excepcionNegativo(Real $x) {
- die "negative" if $x < 0;
- $x.sqrt;
- }
- for 5, -3 -> $n {
- say "La raiz cuadrada del numero $n es: ", excepcionNegativo($n);
- CATCH {
- when 'negative' {
- say "No se puede calcular raiz cuadrada del numero $n"
- }
- default {
- say "Hola";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement