ONLY DO WHAT ONLY YOU CAN DO

こけたら立ちなはれ 立ったら歩きなはれ

Swift で 99 Bottles of Beer

Paiza が Swift に対応したと聞いたので
https://paiza.io/

for i in (1...99).reverse() 
{ 
    print("\(i) bottles of beer on the wall, \(i) bottles of beer.\n")
    let next = i == 1 ? "no" : i.description
    print("Take one down and pass it around, \(next) bottles of beer on the wall.\n")    
}
99 bottles of beer on the wall, 99 bottles of beer.

Take one down and pass it around, 99 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.

Take one down and pass it around, 98 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.

Take one down and pass it around, 97 bottles of beer on the wall.

(中略)

3 bottles of beer on the wall, 3 bottles of beer.

Take one down and pass it around, 3 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.

Take one down and pass it around, 2 bottles of beer on the wall.

1 bottles of beer on the wall, 1 bottles of beer.

Take one down and pass it around, no bottles of beer on the wall.