Conjugate a Latin verb: Difference between revisions

(Added 11l)
Line 877:
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">def conjugate(infinitive)
return ["Can not conjugate #{infinitive}"] if infinitive.size < 4
conjugations = case infinitive[-3..-1]
when "are" then ["o", "as", "at", "amus", "atis", "ant"]
when "ēre" then ["eo", "es", "et", "emus", "etis", "ent"]
when "ere" then ["o", "is", "it", "imus", "itis", "unt"]
when "ire" then ["io", "is", "it", "imus", "itis", "iunt"]
else return ["Can not conjugate #{infinitive}"]
end
conjugations.map{|c| infinitive[0..-4] + c}
end
 
["amare", "vidēre", "ducere", "audire","qwerty", "are"].each do |inf|
puts "\n" + inf + ":"
puts conjugate inf
end
</syntaxhighlight>
{{out}}
<pre>
amare:
amo
amas
amat
amamus
amatis
amant
 
vidēre:
video
vides
videt
videmus
videtis
vident
 
ducere:
duco
ducis
ducit
ducimus
ducitis
ducunt
 
audire:
audio
audis
audit
audimus
auditis
audiunt
 
qwerty:
Can not conjugate qwerty
 
are:
Can not conjugate are
</pre>
=={{header|V (Vlang)}}==
{{trans|Go}}
1,149

edits