99 bottles of beer: Difference between revisions
Content deleted Content added
add RPL |
|||
Line 12,446: | Line 12,446: | ||
(v ~~ 0) ifTrue: [ Transcript show: (sr at:4) ; cr. ]. |
(v ~~ 0) ifTrue: [ Transcript show: (sr at:4) ; cr. ]. |
||
].</syntaxhighlight> |
].</syntaxhighlight> |
||
This version uses Squeak Smalltalk's String >> format: method. |
|||
<syntaxhighlight lang="smalltalk"> |
|||
|bottles| |
|||
Transcript clear. |
|||
bottles:='{1} bottle{2} of beer on the wall |
|||
{3} bottle{4} of beer |
|||
Take one down, pass it around |
|||
{5} bottle{6} of beer on the wall'. |
|||
99 to: 1 by: -1 do:[:v | |
|||
(v > 1) |
|||
ifTrue:[Transcript show: (bottles format: {(v asString) . 's' . (v asString) . 's' . ((v -1) asString). 's'}); cr; cr.] |
|||
ifFalse:[Transcript show: (bottles format: {(v asString) . '' . (v asString) . '' . ((v -1) asString). ''}); cr; cr.] |
|||
]. |
|||
Transcript show: 'hic!'; cr. |
|||
</syntaxhighlight> |
|||
=={{header|SmileBASIC}}== |
=={{header|SmileBASIC}}== |