La version 2 lignes de Ruby : quasimment une copie de la version Python:
a,t="\n%s bottles of beer on the wall","\nTake one down, pass it around"
99.downto(0) {|i| puts((a%[i]*2)[0..-12]+t+a%[i-1==0 ? i-1 : 'No'])}
Pour un autre fun : http://redhanded.hobix.com/bits/aFileSharingParagraph.html(...)
[^] # Re: Différence avec Python ?
Posté par Frederick Ros . En réponse à la dépêche Sortie de Ruby 1.8.2. Évalué à 1.
a,t="\n%s bottles of beer on the wall","\nTake one down, pass it around" 99.downto(0) {|i| puts((a%[i]*2)[0..-12]+t+a%[i-1==0 ? i-1 : 'No'])}Pour un autre fun : http://redhanded.hobix.com/bits/aFileSharingParagraph.html(...)