CheckWordIsValid

From TRCCompSci - AQA Computer Science
Revision as of 13:52, 14 November 2017 by Admin (talk | contribs) (Created page with "<syntaxhighlight lang=csharp> private static bool CheckWordIsValid(string Word, List<string> AllowedWords) { bool ValidWord = false; in...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
        private static bool CheckWordIsValid(string Word, List<string> AllowedWords)
        {
            bool ValidWord = false;
            int Count = 0;
            while (Count < AllowedWords.Count && !ValidWord)
            {
                if (AllowedWords[Count] == Word)
                {
                    ValidWord = true;
                }
                Count++;
            }
            return ValidWord;
        }