From 30aaf4ed8072798e0965fc39583fbbf76d103a19 Mon Sep 17 00:00:00 2001 From: darkf Date: Wed, 23 Oct 2013 19:35:35 -0700 Subject: [PATCH] add loop example --- examples/loop.lamb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/loop.lamb diff --git a/examples/loop.lamb b/examples/loop.lamb new file mode 100644 index 0000000..88e06cd --- /dev/null +++ b/examples/loop.lamb @@ -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). \ No newline at end of file