-
-
Save oelmekki/1271304 to your computer and use it in GitHub Desktop.
flexion.rb
This file contains hidden or 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
#!/usr/bin/ruby | |
pronoms = [ "je", "tu", "il/elle", "nous", "vous", "ils/elles" ] ; | |
terminaisons_1 = [ "e", "es", "e", "ons", "ez", "ent" ] ; | |
terminaisons_2 = [ "is", "is", "it", "issons", "issez", "issent" ] ; | |
def conjugator | |
puts "Les formes du verbe " + verb + " au présent de l'indicatif sont :\n" | |
inf = verb.gsub(/.{2}$/, "") | |
pronoms.each_index{|x| | |
print pronoms[x] + " " + inf + terminaisons[x] + "\n"} | |
end | |
puts "Entrez un verbe du 1er ou 2nd groupe :\n" | |
verb = gets.chomp | |
if verb =~ /er$/ | |
terminaisons = terminaisons_1 | |
conjugator | |
elsif | |
verb =~ /ir$/ | |
terminaisons = terminaisons_2 | |
conjugator | |
else | |
puts "Ceci n'est pas un verbe du premier ou du second groupe !" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment