add more complex examples (#1)

This commit is contained in:
Juraj Michálek 2024-10-22 10:14:59 +02:00 committed by GitHub
commit a01d8580d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1657 additions and 204 deletions

11
assets/fibonacci.lua Normal file
View file

@ -0,0 +1,11 @@
-- fibonacci.lua
-- This script calculates the 10th number in the Fibonacci sequence and prints it.
local function fibonacci(n)
if n <= 1 then return n end
return fibonacci(n - 1) + fibonacci(n - 2)
end
local fib_10 = fibonacci(10)
print('Fibonacci of 10 is: ' .. fib_10)
return fib_10