Skip to content

Instantly share code, notes, and snippets.

@elizabrock
Last active August 29, 2015 14:18
Show Gist options
  • Save elizabrock/3b0f56fcd86066893168 to your computer and use it in GitHub Desktop.
Save elizabrock/3b0f56fcd86066893168 to your computer and use it in GitHub Desktop.
Cheers Iterations (Cohort 8)
puts "Hello, What's your name?"
name = gets.chomp.upcase
# Loop through each letter in their name and grammar it.
for letter in name.split("") do
if letter == "A" or letter == "E" or letter == "F" or letter == "H" or letter == "I" or letter == "L" or letter == "M" or letter == "N" or letter == "O" or letter == "R" or letter == "S" or letter == "X"
article = "an"
else
article = "a"
end
puts "Give me "+ article + "... " + letter + "!"
end
puts name + "'s just GRAND!"
puts "Hello, What's your name?"
name = gets.chomp.upcase
# Loop through each letter in their name and grammar it.
for letter in name.split("") do
an_letters = ["A", "E", "F", "H", "I", "L", "M", "N", "O", "R", "S", "X"]
article = "a"
for an_letter in an_letters do
if an_letter == letter
article = "an"
end
end
puts "Give me "+ article + "... " + letter + "!"
end
puts name + "'s just GRAND!"
puts "Hello, What's your name?"
name = gets.chomp.upcase
# Loop through each letter in their name and grammar it.
for letter in name.split("") do
an_letters = "AEFHILMNORSX"
article = "a"
if an_letters.include?(letter)
article = "an"
end
puts "Give me "+ article + "... " + letter + "!"
end
puts name + "'s just GRAND!"
puts "Hello, What's your name?"
name = gets.chomp.upcase
# Loop through each letter in their name and grammar it.
an_letters = "AEFHILMNORSX"
name.each_char do |letter|
article = an_letters.include?(letter) ? "an" : "a"
puts "Give me "+ article + "... " + letter + "!"
end
puts name + "'s just GRAND!"
puts "Hello, What's your name?"
name = gets.chomp.upcase
an_letters = "AEFHILMNORSX"
name.each_char do |letter|
article = an_letters.include?(letter) ? "an" : "a"
puts "Give me #{article}... #{letter}!"
end
puts name + "'s just GRAND!"
puts "Hello, What's your name?"
name = gets.chomp.upcase
while name.empty?
puts "Hello, What's your name?"
name = gets.chomp.upcase
end
an_letters = "AEFHILMNORSX"
name.each_char do |letter|
article = an_letters.include?(letter) ? "an" : "a"
puts "Give me #{article}... #{letter}!"
end
puts name + "'s just GRAND!"
def ask_for_name
puts "Hello, What's your name?"
gets.chomp.upcase
end
name = ask_for_name
while name.empty?
name = ask_for_name
end
an_letters = "AEFHILMNORSX"
name.each_char do |letter|
article = an_letters.include?(letter) ? "an" : "a"
puts "Give me #{article}... #{letter}!"
end
puts name + "'s just GRAND!"
def ask_for_name
puts "Hello, What's your name?"
gets.chomp.upcase
end
name = ""
while name.empty?
name = ask_for_name
end
name.gsub!(/[^\w]/, "")
an_letters = "AEFHILMNORSX"
name.each_char do |letter|
article = an_letters.include?(letter) ? "an" : "a"
puts "Give me #{article}... #{letter}!"
end
puts name + "'s just GRAND!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment