aboutsummaryrefslogtreecommitdiff
path: root/examples/stdlib.stem
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-12 11:02:57 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-12 11:02:57 -0800
commit0045795a808d2017bd8e7db9b43a57192ba5eed7 (patch)
tree7552943016e4c436ba5dae1ad63be0c29e0c3963 /examples/stdlib.stem
parent8d9709720b8b7007d7178723c93feb6c881e546a (diff)
add loop
Diffstat (limited to 'examples/stdlib.stem')
-rw-r--r--examples/stdlib.stem9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/stdlib.stem b/examples/stdlib.stem
index eca48c8..00a4f67 100644
--- a/examples/stdlib.stem
+++ b/examples/stdlib.stem
@@ -1,2 +1,11 @@
evalstr [ strquote eval ] func
include [ fread evalstr ] func
+
+# Author of loop function: Andrei S
+loop [
+ swap dup 0 > [
+ swap
+ dup eval
+ swap 1 - swap loop
+ ] [ dsc dsc ] if
+] func