I'm wondering if the precedence of the "return" keyword isn't wrong
in pugs.  In the code below, fibo2 works as I'd expected, fibo returns
nothing.  (If this is expected behavior, I'd apppreciate someone
pointing me to TFM).

Thanks,

Greg Buchholz


#!perl6
use v6;

sub fib  ($n) { return  ($n<2) ?? 1 :: fib($n-2)  + fib($n-1)   }
sub fib2 ($n) { return (($n<2) ?? 1 :: fib2($n-2) + fib2($n-1)) }

my $x = fib(6);
say " fib(6)=$x";

my $y = fib2(6);
say "fib2(6)=$y"; 

Reply via email to