- Joined
- Jul 6, 2006
- Messages
- 666 (0.10/day)
- Location
- England, UK
Processor | AMD Athlon 3800+ X2 |
---|---|
Motherboard | ASUS A8N-SLI SE |
Cooling | 2 Exhaust fans |
Memory | 2x512MB DDR400 RAM |
Video Card(s) | Connect3D ATI Radeon X1900XT 512MB |
Storage | 80GB Maxtor DiamondMax |
Display(s) | Packard bell 17" CRT |
Case | Stock |
Power Supply | 580W Hiper Type-R |
Hi folks, ive just begun programming and im having trouble with looping the result of an if else statement, basically my code looks like this:
Console.Clear();
Console.Write("Please enter your catagory: ");
string = Console.ReadLine();
if (string == "A" || string == "a");
{
Console.Write("You entered A");
}
else if (string == "B" || string == "b");
{
Console.Write("You entered B");
}
else if (string == "C" || string == "c");
{
Console.Write("You entered C");
}
else
{
Console.Write("You have not entered a valid catagory");
Console.Write("\nPress enter to re-enter...");
}
I tried entering a do while but in the while condition i didnt know what to put so that it loops the result of the else, i want it to loop from the clear so that the person can re-enter there catagory if the else statement is activated. Thanks for any help/advice
Console.Clear();
Console.Write("Please enter your catagory: ");
string = Console.ReadLine();
if (string == "A" || string == "a");
{
Console.Write("You entered A");
}
else if (string == "B" || string == "b");
{
Console.Write("You entered B");
}
else if (string == "C" || string == "c");
{
Console.Write("You entered C");
}
else
{
Console.Write("You have not entered a valid catagory");
Console.Write("\nPress enter to re-enter...");
}
I tried entering a do while but in the while condition i didnt know what to put so that it loops the result of the else, i want it to loop from the clear so that the person can re-enter there catagory if the else statement is activated. Thanks for any help/advice