Difference between revisions of "CheckWordIsValid"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "<syntaxhighlight lang=csharp> private static bool CheckWordIsValid(string Word, List<string> AllowedWords) { bool ValidWord = false; in...")
(No difference)

Revision as of 12:52, 14 November 2017

        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;
        }