Use multiple assignments in Fibonacci example
-- Please refer to the LICENSE and AUTHORS files for details
-- SPDX-License-Identifier: MIT
-function fibonacci(count: integer): { integer }
- local a: integer = 0
- local b: integer = 1
- local i: integer = 1
+function fibonacci(N: integer): { integer }
local result: { integer } = {}
- while i <= count do
+ local a, b = 0, 1
+ for i = 1, N do
result[i] = a
- local c: integer = a + b
- a = b
- b = c
- i = i + 1
+ a, b = b, a+b
end
return result
end
