Created
February 2, 2021 12:21
-
-
Save dennisvink/465d68c86c4e6735ae233ba2e2ae7291 to your computer and use it in GitHub Desktop.
Practice Spanish: months of the year
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
## Practice the months in Spanish | |
es_months = %w( | |
enero | |
febrero | |
marzo | |
abril | |
mayo | |
junio | |
julio | |
agosto | |
septiembre | |
octubre | |
noviembre | |
diciembre | |
) | |
en_months = %w( | |
january | |
february | |
march | |
april | |
may | |
june | |
july | |
august | |
september | |
october | |
november | |
december | |
) | |
while loop do | |
month = rand(0..11) | |
cat = rand(2) | |
question = "" | |
answer = "" | |
if(cat == 0) | |
question = "Que es #{es_months[month]} en Ingles?" | |
answer = en_months[month] | |
else | |
question = "What is #{en_months[month]} in Spanish?" | |
answer = es_months[month] | |
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