aboutsummaryrefslogtreecommitdiff
path: root/buzzard/demo3.th
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-06-10 23:18:31 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-06-10 23:18:31 +0200
commitda312e375eb0a0758a4dd72e287d3aba86c04d99 (patch)
treeaa7d3631273b516e7f10ef40a53a5edd21a81b7e /buzzard/demo3.th
parente4d7ac43458f9f96a15041d35feddecca20ddbba (diff)
Add FIRST & THIRD almost FORTH
Diffstat (limited to 'buzzard/demo3.th')
-rw-r--r--buzzard/demo3.th15
1 files changed, 15 insertions, 0 deletions
diff --git a/buzzard/demo3.th b/buzzard/demo3.th
new file mode 100644
index 0000000..c061b74
--- /dev/null
+++ b/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