Skip to content

Commit

Permalink
finished beers
Browse files Browse the repository at this point in the history
  • Loading branch information
erisfully committed Jun 18, 2014
1 parent a422fbc commit e6fc83b
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions 99_beers.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@

puts "Let's sing! How many beers are there on the wall?"

reply = gets.chomp

while reply == ''

if reply == ''
puts "I need to know how many bottles to sing!"
reply = gets.chomp
end

full_reply = reply.split
if full_reply[0] == 'sing' && full_reply[1] == '8'
puts "8 bottles on the wall"
else puts "ERROR"
end


if full_reply[0] != "sing" || full_reply[1].to_i <= 0
puts "ERROR!!"

else full_reply[0] == "sing" && full_reply[1].to_i > 0
puts full_reply[1] + " bottles of beer on the wall"
puts full_reply[1] + " bottles of beer"
puts "take one down and pass it around"
puts (full_reply[1].to_i - 1).to_s + " bottles of beer of the wall!"

end




0 comments on commit e6fc83b

Please sign in to comment.