Skip to content

Instantly share code, notes, and snippets.

@Strelok78
Last active May 17, 2023 07:17
Show Gist options
  • Save Strelok78/8dd5161982dc2ba7e0c08ee202567a0b to your computer and use it in GitHub Desktop.
Save Strelok78/8dd5161982dc2ba7e0c08ee202567a0b to your computer and use it in GitHub Desktop.
Accepts a word from the user and outputs its meaning. If there is no such word, it displays the corresponding message.
internal class Program
{
public static void Main()
{
string enteredText;
string returnedValue;
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("aaa", "sss");
keyValuePairs.Add("bbb", "rrr");
keyValuePairs.Add("GDev", "Game Developer");
keyValuePairs.Add("GD", "Game Designer");
enteredText= Console.ReadLine();
if (keyValuePairs.TryGetValue(enteredText, out returnedValue))
Console.WriteLine(returnedValue);
else
Console.WriteLine("Error");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment