Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             //Changing user input to lower case, then comparing with string.
  4.  
  5.             //string sElvish = "elvish";
  6.  
  7.             //string userInput = Console.ReadLine();
  8.  
  9.             //string lowerUserInput = userInput.ToLower();
  10.  
  11.             //Console.WriteLine(lowerUserInput);
  12.  
  13.             //if (lowerUserInput == sElvish)
  14.             //{
  15.             //    //do something here.
  16.             //}
  17.  
  18.             //else
  19.             //{
  20.             //    //Do something else here.
  21.             //}
  22.  
  23.             //Console.ReadLine();
  24.  
  25.             //Getting user input then comparing that to an array.
  26.  
  27.             string[] myArray = new string[] { "Elvish", "elvish" };
  28.  
  29.             string userInput = Console.ReadLine();
  30.             if (myArray.Contains(userInput))
  31.             {
  32.                 //Do something here.
  33.             }
  34.  
  35.             else
  36.             {
  37.                 //Do something different here.
  38.             }
  39.  
  40.             Console.ReadLine();
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement