+ 4
MrDevEzeoke You can store all string in an array and using loop you can check. If any string exist then break the loop. https://code.sololearn.com/c677tEMtcmNK/?ref=app
16th Jan 2021, 10:23 AM
A͢J
A͢J - avatar
+ 5
MrDevEzeoke , what you could do additionally is to spell the "keywords" in lower case: string[] words = {"how", "where", "why", "when", "which"}; then also convert the input to lower case: string question = Console.ReadLine().ToLower(); This makes it possible to find "Why" as well as "why" or whatever case is used.
16th Jan 2021, 3:37 PM
Lothar
Lothar - avatar
+ 3
MrDevEzeoke Can Contains accept multiple String?
16th Jan 2021, 10:03 AM
A͢J
A͢J - avatar
+ 3
Or starting from the array of keywords you can combine Any() and Contains(). To use Any() you have to include Linq. if(Keywords.Any(kw => question.Contains(kw)))
16th Jan 2021, 10:28 AM
Benjamin JĂźrgens
Benjamin JĂźrgens - avatar