mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-06 12:46:53 +08:00
![Thakee Nathees](/assets/img/avatar_default.png)
- popping operands from the stack was too early -fixed - some temproary string objects weren't pushed to the vm's temp root -fixed - and some minor bug fixed
15 lines
182 B
Ruby
15 lines
182 B
Ruby
|
|
def fib(n)
|
|
if n < 2 then
|
|
n
|
|
else
|
|
fib(n - 1) + fib(n - 2)
|
|
end
|
|
end
|
|
|
|
start = Time.now
|
|
for i in 0...10
|
|
puts fib(28)
|
|
end
|
|
puts "elapsed: " + (Time.now - start).to_s + ' s'
|