Last active
June 30, 2019 13:44
-
-
Save fstamour/6418bca1ffda2db21bf9d10ae69ea212 to your computer and use it in GitHub Desktop.
fizzbuzz in forth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env gforth | |
( n -- ) | |
: fizz? 3 mod 0= if ." Fizz" then ; | |
( n -- ) | |
: buzz? 5 mod 0= if ." Buzz" then ; | |
( n -- ) | |
: fizzbuzz? dup fizz? buzz?; | |
( n -- ) | |
: fizzbuzz 0 do i dup . fizzbuzz? cr loop ; | |
50 fizzbuzz | |
bye |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment