mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-07 07:18:48 +00:00
Procedures in interpretation
This commit is contained in:
parent
30697f19eb
commit
b4ef95c8bc
22 changed files with 337 additions and 188 deletions
18
regression/test029.expr
Normal file
18
regression/test029.expr
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
fun fib (n) local r {
|
||||
if n <= 1
|
||||
then result := 1
|
||||
else
|
||||
fib (n-1);
|
||||
r := result;
|
||||
fib (n-2);
|
||||
result := result + r
|
||||
fi
|
||||
}
|
||||
|
||||
read (n);
|
||||
|
||||
for i := n, i >= 1, i := i-1 do
|
||||
fib (i);
|
||||
write (i);
|
||||
write (result)
|
||||
od
|
||||
Loading…
Add table
Add a link
Reference in a new issue