add loop example

This commit is contained in:
darkf 2013-10-23 19:35:35 -07:00
parent 8fda79b9a9
commit 30aaf4ed80
1 changed files with 14 additions and 0 deletions

14
examples/loop.lamb Normal file
View File

@ -0,0 +1,14 @@
-- loop takes a function and loops until the application of that function returns false
-- this would be an infinite loop
-- forever() -> true.
-- loop(forever).
-- can take an argument
f(i) -> do
print("hi");
print(i);
false -- only loop once
end.
loop(f, 10).