Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Call for examples

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> VFScript
View previous topic :: View next topic  
Author Message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 729

PostPosted: Jan 25th, 2012, 1:12am    Post subject: Call for examples Reply with quote

I think there's enough documentation for about anybody to learn VFScript's syntax and semantics. What the docs miss the most are examples. I'm not the greatest when it comes to making simple, clear examples. If you can think up some interesting examples, I will give you due credit. Even when there's already an example, maybe you can come up with something better. Preferably an example should be as small as possible while getting across the essentials of the feature.

If you want to help, post your example in this topicc or double-click the section of the docs. When doing the former, please tell what feature the example demonstrates.

I will probably also be adding a section with a complete program or two. Below is my program that can translate English to Pig Latin. Feel free to discuss the merits of any submitted example.
Code:
Do
  PigLatin = ""
  Prompt "Type some text you want in Pig Latin.", English
  English = Trim(English)
  If Len(English) = 0 Then
    Exit Do
  End If
  w = 1
  EnWord = Word(English, w) & Space(1)
  Do While Len(EnWord)
    i = 1
    Do Until InStr("aeiou ", Mid(EnWord, i, 1), , CaseIns)
      i = i + 1
    Loop
    idxVowel = i
    EnWord = Trim(EnWord)
    If idxVowel > Len(EnWord) Then ' contains no vowels
      PLWord = EnWord
    ElseIf idxVowel > 1 Then ' starts w/ consonant(s)
      PLWord = Mid(EnWord, idxVowel) & "-" & Left(EnWord, idxVowel - 1) & "ay"
    Else ' starts w/ vowel
      PLWord = EnWord & "-way"
    End If
    PigLatin = PigLatin & PLWord & Space(1)
    w = w + 1
    EnWord = Word(English, w)
  Loop
  MsgBox PigLatin, "Pig Latin", "rc", pressed
Loop While pressed = 1

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> VFScript All times are GMT
Page 1 of 1
Jump to:  
Quick Reply
Username:
Message:
   Shortcut keys: Alt+Q to activate, Alt+P to preview, Alt+S to submit
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group