Comment by BanazirGalbasi

2 months ago

Rather than Hello World, I'd rather see something like a classic Fibonacci calculator with recursion. That way you see function definitions, variable typing, math operations (Lua doesn't have increment/decrement operators or augmented assignments), and even tail-call recursion if it's an option. Hello World is really only useful as an environment verification - do you have your machine set up so you can run the code, or are you missing something?

  function fib(a)
    return countfib(1,1,a)
  end
  function countfib(a,b,n)
    if n == 1 then
      return a
    else
      -- proper tail call
      return countfib(b,a+b,n-1)
    end
  end
  print(fib(6)) --> 8