Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
20
Task/Fibonacci-sequence/LiveCode/fibonacci-sequence.livecode
Normal file
20
Task/Fibonacci-sequence/LiveCode/fibonacci-sequence.livecode
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-- Iterative, translation of the basic version.
|
||||
function fibi n
|
||||
put 0 into aa
|
||||
put 1 into b
|
||||
repeat with i = 1 to n
|
||||
put aa + b into temp
|
||||
put b into aa
|
||||
put temp into b
|
||||
end repeat
|
||||
return aa
|
||||
end fibi
|
||||
|
||||
-- Recursive
|
||||
function fibr n
|
||||
if n <= 1 then
|
||||
return n
|
||||
else
|
||||
return fibr(n-1) + fibr(n-2)
|
||||
end if
|
||||
end fibr
|
||||
Loading…
Add table
Add a link
Reference in a new issue