c# cmd if writing something else shows a msg

Asked

Viewed 34 times

-2

Hello I would like to know how I could do on cmd so that when someone wrote anything other than Tree it appeared a msg to say "what you wrote" was not recognized...

1 answer

2


Just make one condition, simple

string input = Console.ReadLine();
if (input == "tree")
{
    Console.WriteLine("tree");
}
else
{
    Console.WriteLine("o que escreveu não foi reconhecido!");
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.