99 Bottles of Beer: Unterschied zwischen den Versionen
aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen (Die Seite wurde neu angelegt: | 99 Bottles of Beer in Reva Forth | by Phantasus : .bottle ( n -- n) dup 1 >if ." bottles of" space ;then ." bottle of" space ; : .wall ( n -- n ) dup 0 >if dup . .bo...) |
|||
Zeile 1: | Zeile 1: | ||
− | + | Das gute alte 99 bottles in Forth | |
− | |||
− | : .bottle ( n -- n) dup 1 >if ." bottles of" space ;then ." bottle of" space ; | + | 99 bottles of beer on the wall, |
− | : .wall ( n -- n ) dup 0 >if dup . .bottle ." beer on the wall," cr ;then | + | 99 bottles of beeeeer . . . , |
+ | Take one down, pass it around, | ||
+ | 98 bottles of beer on the wall. | ||
+ | ... | ||
+ | |||
+ | |||
+ | | 99 Bottles of Beer in Reva Forth | ||
+ | | by Phantasus | ||
+ | |||
+ | : .bottle ( n -- n) dup 1 >if ." bottles of" space ;then ." bottle of" space ; | ||
+ | : .wall ( n -- n ) dup 0 >if dup . .bottle ." beer on the wall," cr ;then | ||
." No more bottles of beer on the wall." cr | ." No more bottles of beer on the wall." cr | ||
− | ; | + | ; |
− | : .beer ( n -- n ) dup . .bottle ." beeeeer . . . ," cr ; | + | : .beer ( n -- n ) dup . .bottle ." beeeeer . . . ," cr ; |
− | : .take ( n -- n-1 ) ." Take one down, and pass it around," cr 1- ; | + | : .take ( n -- n-1 ) ." Take one down, and pass it around," cr 1- ; |
− | : 99beer ( -- ) 99 100 1 do .wall .beer .take .wall cr loop | + | : 99beer ( -- ) 99 100 1 do .wall .beer .take .wall cr loop |
− | + | ." Time to buy more beer!" cr | |
− | ; | + | ; |
− | 99beer | + | 99beer |
Version vom 3. März 2007, 16:27 Uhr
Das gute alte 99 bottles in Forth
99 bottles of beer on the wall, 99 bottles of beeeeer . . . , Take one down, pass it around, 98 bottles of beer on the wall. ...
| 99 Bottles of Beer in Reva Forth | by Phantasus
: .bottle ( n -- n) dup 1 >if ." bottles of" space ;then ." bottle of" space ; : .wall ( n -- n ) dup 0 >if dup . .bottle ." beer on the wall," cr ;then ." No more bottles of beer on the wall." cr ; : .beer ( n -- n ) dup . .bottle ." beeeeer . . . ," cr ; : .take ( n -- n-1 ) ." Take one down, and pass it around," cr 1- ; : 99beer ( -- ) 99 100 1 do .wall .beer .take .wall cr loop ." Time to buy more beer!" cr ; 99beer