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
12
Task/Anonymous-recursion/Lingo/anonymous-recursion-1.lingo
Normal file
12
Task/Anonymous-recursion/Lingo/anonymous-recursion-1.lingo
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
on fib (n)
|
||||
if n<0 then return _player.alert("negative arguments not allowed")
|
||||
|
||||
-- create instance of unnamed class in memory only (does not pollute namespace)
|
||||
m = new(#script)
|
||||
r = RETURN
|
||||
m.scriptText = "on fib (me,n)"&r&"if n<2 then return n"&r&"return me.fib(n-1)+me.fib(n-2)"&r&"end"
|
||||
aux = m.script.new()
|
||||
m.erase()
|
||||
|
||||
return aux.fib(n)
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
put fib(10)
|
||||
-- 55
|
||||
Loading…
Add table
Add a link
Reference in a new issue