Anonymous recursion: Difference between revisions

m
imported>Lacika7
mNo edit summary
imported>Arakov
(3 intermediate revisions by 3 users not shown)
Line 483:
==={{header|IS-BASIC}}===
<syntaxhighlight lang="is-basic">100 PROGRAM "Fibonacc.bas"
100 PROGRAM "Fibonacc.bas"
110 FOR I=0 TO 10
120 PRINT FIB(I);
Line 1,050 ⟶ 1,049:
 
=={{header|Elena}}==
ELENA 46.x:
<syntaxhighlight lang="elena">import extensions;
 
fib(n)
{
if (n < 0)
{ InvalidArgumentException.raise() };
^ (n) {
if (n {> 1)
{ if (n > 1)
^ this self(n {- 2) + (this self(n - 1))
}(n)
^ this self(n - 2) + (this self(n - 1))
}else
{ else
^ {n
^ n }
}(n)
}(n)
}
 
public program()
{
for (int i := -1,; i <= 10,; i += 1)
{
console.print("fib(",i,")=");
try
{
console.printLine(fib(i))
}
catch(Exception e)
{
console.printLine:("invalid")
}
};
console.readChar()
}</syntaxhighlight>
{{out}}
Line 3,619 ⟶ 3,617:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">class Fibonacci {
static compute(n) {
var fib
Anonymous user