Pig Latin


Pig Latin is a language game where you alter the English words. The goal is to conceal the meaning of the words from others not familiar with the rules (like you're talking in code or a secret language). The reference to Latin is a misnomer, because it has nothing to do with Latin. It'is simply a form of jargon, used only because it turns your English words into a strange and foreign-sounding language.

According to John R. Hailman's Thomas Jefferson on Wine, Thomas Jefferson used pig latin as a kid. This is one of the earliest known uses of pig latin.

 

For words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and "ay" (some people just add "a") is added, as in the following examples:

  • "pig" → "igpay"
  • "banana" → "ananabay"
  • "trash" → "ashtray"
  • "happy" → "appyhay"
  • "duck" → "uckday"
  • "glove" → "oveglay"

For words which begin with vowel sounds or silent letter, one just adds "yay" to the end. Examples are:

  • "eat" → "eatyay"
  • "omelet" → "omeletyay"
  • "are" → "areyay"

  

Now that you know pig latin, let's program some in Small Basic!

 

While ("True")

   TextWindow.Write("Enter a word: ")

   word = TextWindow.Read()

   pigLatin = Text.GetSubTextToEnd(word, 2) 

   pigLatin = pigLatin + Text.GetSubText(word, 1, 1)

   pigLatin = pigLatin + "ay"                   

   TextWindow.WriteLine(pigLatin)                   

   TextWindow.WriteLine("") 

EndWhile

 

Do you have any questions? Ask us! We're full of answers and other fine things!

Head to the Small Basic forum to get the most answers to your questions: 

http://social.msdn.microsoft.com/Forums/en-US/smallbasic/threads/   

And go to http://blogs.msdn.com/SmallBasic to download Small Basic and learn all about it!

   

Small and Basically yours

- Ninja Ed

Comments (5)

  1. Ha! Thanks, Sean! This program just gets the basics of Pig Latin going. Folks can add more features to get all the nuances down!

  2. June says:

    how do i code for the vowels? How do i code it for a sentence?

    1. That's the challenge. To add onto the code above and take it to the next level.

      Here's the logic:

      1. Take the code above.
      2. You check if each word begins with a vowel. If not, proceed as normal. If so, skip the text above, and instead just add "ay" or "yay" at the end of the word. So the code is actually simpler in comparison (you aren't removing the first letter and appending it at the end), but to check for the vowel condition and give both commands... that adds a bit to the code.

Skip to main content