Skip to content

Instantly share code, notes, and snippets.

@dennisvink
Created February 2, 2021 11:58
Show Gist options
  • Save dennisvink/3b4d694c40d41af72e29f48bc59a64c9 to your computer and use it in GitHub Desktop.
Save dennisvink/3b4d694c40d41af72e29f48bc59a64c9 to your computer and use it in GitHub Desktop.
Practice Spanish: days of the week
## Practice the days of the week in Spanish
es_days = %w(
lunes
martes
miercoles
jueves
viernes
sabado
domingo
)
en_days = %w(
monday
tuesday
wednesday
thursday
friday
saturday
sunday
)
while loop do
day = rand(0..6)
cat = rand(2)
question = ""
answer = ""
if(cat == 0)
question = "Que es #{es_days[day]} en Ingles?"
answer = en_days[day]
else
question = "What is #{en_days[day]} in Spanish?"
answer = es_days[day]
end
puts question
response = gets.chomp
if response == answer
puts "Correct!"
else
if(cat == 0)
puts "Incorrecto! La respuesta fue #{answer.inspect} :("
else
puts "Incorrect! The answer was #{answer.inspect} :("
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment