I need help, I am getting an error on line 2. It says ; is expected but one is already there.
Can someone tell me what I am doing wrong?

//Input
		String input;
	
	//Process
		while (input != ("!"))
            {
        if (input == "A" || input == "a")
                {
                    Console.WriteLine("OK");
                }
                else
        if (input == "E" || input == "e")
                    {
Console.WriteLine("OK");
                    }
                else
        if (input == "I" || input == "i")
                        {
Console.WriteLine("OK");
                        }
                else
        if (input == "O" || input == "o")
                        {
                                Console.WriteLine("OK");
                        }
                else
        if (input == "U" || input == "u")
                        {
                                    Console.WriteLine("OK");
                        }
                else
                                    Console.WriteLine("Error");

   Console.WriteLine("Enter a letter: ");
   Console.ReadLine();
   }

// end while

Recommended Answers

All 2 Replies

The immediately visible error is the use of an unassigned local variable (input).

Once that is fixed, you have the critical error of your code simply not working.

Edit: Nevermind, Apegram's got it. ^^^^^^^^^^^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.