Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- //Written by Joseph Rogers
- //For use in Xcode
- func beerSongForThisManyBottlesOfBeer(_ howManyBottles : Int) -> String {
- var lyrics: String = ""
- for number in (2...howManyBottles).reversed() {
- let newLine: String = "\n\(number) bottles of beer on the wall, \(number) bottles of beer. \nTake one down and pass it around, \(number - 1) bottles of beer on the wall.\n"
- lyrics += newLine
- }
- lyrics += "\n1 bottle of beer on the wall, 1 bottle of beer. \nTake one down and pass it around, no more bottles of beer on the wall.\n"
- lyrics += "\nNo more bottles of beer on the wall, no more bottles of beer. \nGo to the store and buy some more, 99 bottles of beer on the wall."
- return lyrics
- }
- print(beerSongForThisManyBottlesOfBeer(99))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement