Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
[Perl 6] Recursion demo: fibonacci
cwchen
Nov 15th, 2017
11,869
0
Never
2
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
Perl 6
0.21 KB
| None
|
0
0
raw
download
clone
embed
print
report
sub
fib
(
Int
$n
where
$n
>=
0
)
returns
Int
{
if
$n
==
0
{
return
0
;
}
elsif
$n
==
1
{
return
1
;
}
fib
(
$n
-
1
)
+
fib
(
$n
-
2
)
;
}
fib
(
10
)
==
55
or
die
"Wrong number"
;
Advertisement
Comments
User was banned
User was banned
Add Comment
Please,
Sign In
to add comment
Public Pastes
Documents
5 min ago | 0.43 KB
Free Crypto Method
CSS | 6 min ago | 0.70 KB
Crypto admin access
7 min ago | 0.43 KB
+12,000$ in 2 days
CSS | 7 min ago | 0.71 KB
웹 보안 - HTML & JavaScript 기초
21 min ago | 6.45 KB
Trevor-powershell
44 min ago | 0.15 KB
Halo Evolutions 21
7 hours ago | 1.25 KB
EU Defense Stocks
21 hours ago | 0.06 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!