Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Forked from MaximeD/flexion.rb
Created October 7, 2011 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oelmekki/1271304 to your computer and use it in GitHub Desktop.
Save oelmekki/1271304 to your computer and use it in GitHub Desktop.
flexion.rb
#!/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