Show message if a certain word is entered

2

How do I get someone to write to cmd :

> tree 

Display a message using the following command:

Console.Write("");
    
asked by anonymous 26.07.2016 / 23:18

1 answer

3

You can use Console.ReadLine() :

string entrada = Console.ReadLine();
if (entrada == "tree"){
    Console.WriteLine("Mensagem!");
}
    
26.07.2016 / 23:26