summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-02-18 17:35:13 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-02-18 17:35:13 +1300
commit77d84c1539851f096b2c632cc6381ac72b2bfd1b (patch)
treedcdb7e649e481f40a389c07c1d6664961d43d8ca /examples
parent28ab4a097fb73a138850a3fb7f6e480765c702ee (diff)
Implement multline comments
Diffstat (limited to 'examples')
-rw-r--r--examples/fizzbuzz.dumb6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/fizzbuzz.dumb b/examples/fizzbuzz.dumb
index 43b4d82..2ba6033 100644
--- a/examples/fizzbuzz.dumb
+++ b/examples/fizzbuzz.dumb
@@ -1,8 +1,14 @@
+''' bottom of the stack is the incrementing value, starts at 1 '''
1
+''' while the incrementing value is <= 100 '''
WHILE 100 OVER <= DO
+ ''' push string "Buzz" if inc. is divisible by 5, else an empty string '''
5 OVER % IF 0 == DO "Buzz" ELSE "" END
+ ''' push string "Fizz" if inc. is divisible by 3, else an empty string '''
OVER 3 SWAP % IF 0 == DO "Fizz" ELSE "" END
+ ''' concat the two strings and copy the inc., if the string is empty, swap them '''
++ OVER SWAP IF DUP "" == DO SWAP END
+ ''' print the top of the stack, drop the next item, add 1 to inc. '''
. DROP 1 +
END