aboutsummaryrefslogtreecommitdiff
path: root/docs/buzzard/demo3.th
diff options
context:
space:
mode:
Diffstat (limited to 'docs/buzzard/demo3.th')
-rw-r--r--docs/buzzard/demo3.th15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/buzzard/demo3.th b/docs/buzzard/demo3.th
new file mode 100644
index 0000000..c061b74
--- /dev/null
+++ b/docs/buzzard/demo3.th
@@ -0,0 +1,15 @@
+: printfour
+
+ dup ( save the number on top of the stack )
+ 4 = ( compare it to four )
+ if
+ " forth " ( output a string for it )
+ drop ( and delete the saved value )
+ else
+ .
+ endif
+;
+
+: demo3 10 0 do i printfour loop cr ;
+
+demo3