0
How to full fill the condition of iteration in array using Contain method
C# Module Project Word, how do i print no match statement after iterating through array. I am using foreach loop, but it returning no match for every input case letter along with the word. TIA.
2 odpowiedzi
+ 1
Use a boolean variable initialized as false. While checking if you find the value, set it to true. After the loop, if boolean is false print no match
0
Example in string method Contains
using System;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
string wordarr = "Hello World";
string findword = "World";
if (wordarr.Contains(findword))
Console.Write("Contains");
else Console.Write("No match");
}
}
}