1 (
     
2   *********************************************************
     
3   99 Bottles of Beer
     
4   Example by Arf Dysg
     
5   http://www.99-bottles-of-beer.net/language-forth-793.html
     
6 
     7   Lightly modified by Dave Gauer:
     
8     * +LOOP changed to -LOOP
     
9     * Explicit SPACE added
    
10   *********************************************************
    
11 )
    
12 
    13 : MANY ( n) ?DUP IF . ELSE ." No more " THEN ; ( the number)
    
14 : BOTTLES ( n) ." bottle" 1 - IF ." s" THEN ; ( handle plural)
    
15 
    16 : BEER ( n) CR DUP MANY BOTTLES SPACE ." of beer" ;
    
17 : WALL SPACE ." on the wall" ;
    
18 : DRINK CR ." Take one down and pass it around." ;
    
19 : BUY CR ." Go to the store and buy some more." ;
    
20 
    21 : ANOTHER ( n-n) ?DUP IF DRINK 1- ELSE BUY 99 THEN ;
    
22 
    23 : VERSE ( n) DUP BEER WALL DUP BEER ANOTHER BEER WALL CR ;
    
24 : VERSES ( n) 0 SWAP DO I VERSE 1 -LOOP ;
    
25 
    26 99 VERSES