Skip to main content
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

There are quitequite aa largelarge numbernumber ofof existingexisting implementatonsimplementatons ofof FizzBuzzFizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee.

: FIZZBUZZ ( -- )
  CR 100 1 DO 
     I 3 MOD 0= I 5 MOD 0= 2DUP AND IF 
        ." fizzbuzz " DROP DROP
     ELSE IF 
        ." buzz " DROP
     ELSE IF 
        ." fizz " 
     ELSE I . THEN THEN THEN
  LOOP ;

I'm interested in a general review, including possible alternatives to the use of MOD, and whether further factoring should be used. For those unfamiliar with Forth, try http://www.forth.org/tutorials.html

There are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee.

: FIZZBUZZ ( -- )
  CR 100 1 DO 
     I 3 MOD 0= I 5 MOD 0= 2DUP AND IF 
        ." fizzbuzz " DROP DROP
     ELSE IF 
        ." buzz " DROP
     ELSE IF 
        ." fizz " 
     ELSE I . THEN THEN THEN
  LOOP ;

I'm interested in a general review, including possible alternatives to the use of MOD, and whether further factoring should be used. For those unfamiliar with Forth, try http://www.forth.org/tutorials.html

There are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee.

: FIZZBUZZ ( -- )
  CR 100 1 DO 
     I 3 MOD 0= I 5 MOD 0= 2DUP AND IF 
        ." fizzbuzz " DROP DROP
     ELSE IF 
        ." buzz " DROP
     ELSE IF 
        ." fizz " 
     ELSE I . THEN THEN THEN
  LOOP ;

I'm interested in a general review, including possible alternatives to the use of MOD, and whether further factoring should be used. For those unfamiliar with Forth, try http://www.forth.org/tutorials.html

Notice removed Draw attention by Vogel612
Bounty Ended with Simon Forsberg's answer chosen by Vogel612
Notice added Draw attention by Vogel612
Bounty Started worth 100 reputation by Vogel612
Post Reopened by Edward, syb0rg, Jamal
pasted correct code version
Source Link
Edward
  • 67.2k
  • 4
  • 120
  • 284

There are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee.

: FIZZBUZZ ( -- )
  CR 100 1 DO 
     I 3 MOD 0= I 5 MOD 0= 2DUP AND IF 
        ." fizzbuzz " DROP DROP
     THENELSE IF 
        ." buzz " DROP
     THENELSE IF 
        ." fizz " 
     ELSE I . THEN THEN THEN
  LOOP ;

I'm interested in a general review, including possible alternatives to the use of MOD, and whether further factoring should be used. For those unfamiliar with Forth, try http://www.forth.org/tutorials.html

There are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee.

: FIZZBUZZ ( -- )
  CR 100 1 DO 
     I 3 MOD 0= I 5 MOD 0= 2DUP AND IF 
        ." fizzbuzz " 
     THEN IF 
        ." buzz " 
     THEN IF 
        ." fizz " 
     ELSE I . THEN 
  LOOP ;

I'm interested in a general review, including possible alternatives to the use of MOD, and whether further factoring should be used. For those unfamiliar with Forth, try http://www.forth.org/tutorials.html

There are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee.

: FIZZBUZZ ( -- )
  CR 100 1 DO 
     I 3 MOD 0= I 5 MOD 0= 2DUP AND IF 
        ." fizzbuzz " DROP DROP
     ELSE IF 
        ." buzz " DROP
     ELSE IF 
        ." fizz " 
     ELSE I . THEN THEN THEN
  LOOP ;

I'm interested in a general review, including possible alternatives to the use of MOD, and whether further factoring should be used. For those unfamiliar with Forth, try http://www.forth.org/tutorials.html

Post Closed as "Not suitable for this site" by 200_success
[Edit removed during grace period]
Link
Mathieu Guindon
  • 75.6k
  • 18
  • 194
  • 468
Tweeted twitter.com/#!/StackCodeReview/status/488059622545432576
Source Link
Edward
  • 67.2k
  • 4
  • 120
  • 284
Loading