Hey I am a newbie to C#(or programming you could say as I only learned html and css before) I was playing around with generics a bit and I made a small dictionary. There is no problem with searching the word and stuffs but when I search a word that does not match my word it throws up and error how do I solve this please help!
for (int i = 1; i <= 10; i++)
{
Dictionary<string, string> fivewordDictionary = new Dictionary<string, string>();
fivewordDictionary.Add("hello", "Saying greeting");
fivewordDictionary.Add("bye", "Greeting when someone is leaving");
fivewordDictionary.Add("programming", " I dont even know what it is");
fivewordDictionary.Add("C#", "An object oriented programming language");
Console.WriteLine();
Console.Write("Word: ");
string userWord = Console.ReadLine();
Console.WriteLine();
string s = userWord.ToLower().Trim();
Console.WriteLine(userWord + ": " + fivewordDictionary[s]);