forked from seanmsmith23/ruby-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|
||
|