Skip to content

Instantly share code, notes, and snippets.

@Gorbatchevski
Last active December 15, 2015 15:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gorbatchevski/5280623 to your computer and use it in GitHub Desktop.
Save Gorbatchevski/5280623 to your computer and use it in GitHub Desktop.
Translates a word into pig latin
def translate_into_pig_latin(word)
if word[0] == "a"|| word[0]== "e" || word[0] == "i"|| word[0] == "u" || word[0] == "o"
word+"ay"
elsif (word[0] != "a"|| word[0] != "e" || word[0] != "i"|| word[0] != "u") && (word[1] == "a" || word[1] == "o" || word[1] == "e" || word [1] == "i" || word[1] == "u") && word[0..1] != "qu"
word[1..-1]+word[0]+"ay"
elsif (word[0] != "a"|| word[0] != "e" || word[0] != "i"|| word[0] != "u") && (word[1] != "a" || word[1] != "o" || word[1] != "e" || word [1] != "i" || word[1] != "u")
word[2..-1]+word[0..1]+"ay"
elsif word[0..1]="qu"
word[2..-1]+"quay"
else
123
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment