mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-25 16:40:15 +00:00
CPunch
c8cae03604
- 'var' has some weird scoping connotations with users of JS. better to change it to 'let', which will decide whether to make the variable a local or a global - 'func' looks visually appealing lol - some minor refactoring done in cparse.c
11 lines
213 B
Plaintext
11 lines
213 B
Plaintext
local func fib(num)
|
|
if num <= 1 then
|
|
return num
|
|
else
|
|
return fib(num-2) + fib(num-1)
|
|
end
|
|
end
|
|
|
|
for (let i = 1; i < 40; i++) do
|
|
print("The fib number of " .. i .. " is " .. fib(i))
|
|
end |