99 bottles of beer: Difference between revisions
Content added Content deleted
(DM) |
(added more terse alternative) |
||
Line 66: | Line 66: | ||
=={{header|8th}}== |
=={{header|8th}}== |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="forth"> |
||
\ 99 bottles of beer on the wall: |
\ 99 bottles of beer on the wall: |
||
[ |
[ |
||
Line 93: | Line 93: | ||
' beers 1 99 loop- |
' beers 1 99 loop- |
||
bye |
bye |
||
</syntaxhighlight> |
|||
A more terse alternative: |
|||
<syntaxhighlight lang="forth"> |
|||
[ ( "No more bottles of beer on the wall, no more bottles of beer.\n" . ), |
|||
( "Just one more bottle of beer on the wall, one bottle of beer.\n" . ), |
|||
( I dup "%d bottles of beer on the wall, %d bottles of beer.\n" s:strfmt . ) ] constant lyrics |
|||
: app:main |
|||
( lyrics [1,2,99] rot ' n:cmp a:pigeon w:exec I if |
|||
I n:1- "Take one down, pass it around, %d bottles of beer on the wall.\n\n" s:strfmt . |
|||
then |
|||
) 0 99 loop- ; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||