C
C#9mo ago
HD-Fr0sT

How do i make these Readlines not interfere with each other

Its a menu and it has problems
No description
26 Replies
HD-Fr0sT
HD-Fr0sT9mo ago
Console.WriteLine("This is a menu test"); Console.WriteLine("there are (4) options"); Console.WriteLine(""); Console.WriteLine("Start (1) "); Console.WriteLine("Help (2) "); Console.WriteLine("Exit (3)"); //declaration string choice; do{ choice = Console.ReadLine();
if(choice == "1") {
Console.WriteLine("Yay start"); Console.WriteLine("say something"); string answer = Console.ReadLine(); Console.WriteLine(answer);
}

if(choice == "2") { Console.WriteLine("Do this"); }
if(choice == "3") { Console.WriteLine("Bye bye"); return; } else { Console.WriteLine("that was not an answer"); } }while (choice != "quit");
Jimmacle
Jimmacle9mo ago
what do you mean by interfere? also, $code
MODiX
MODiX9mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
HD-Fr0sT
HD-Fr0sT9mo ago
$code
MODiX
MODiX9mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/ To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Jimmacle
Jimmacle9mo ago
just do what the text says
HD-Fr0sT
HD-Fr0sT9mo ago
Console.WriteLine("This is a menu test");
Console.WriteLine("there are (4) options");
Console.WriteLine("");
Console.WriteLine("Start (1) ");
Console.WriteLine("Help (2) ");
Console.WriteLine("Exit (3)");

//declaration
string choice;


do{

choice = Console.ReadLine();


if(choice == "1")
{

Console.WriteLine("Yay start");
Console.WriteLine("say something");
string answer = Console.ReadLine();
Console.WriteLine(answer);


}

if(choice == "2")
{
Console.WriteLine("Do this");
}

if(choice == "3")
{
Console.WriteLine("Bye bye");
return;
}

else
{
Console.WriteLine("that was not an answer");
}

}while (choice != "quit");
Console.WriteLine("This is a menu test");
Console.WriteLine("there are (4) options");
Console.WriteLine("");
Console.WriteLine("Start (1) ");
Console.WriteLine("Help (2) ");
Console.WriteLine("Exit (3)");

//declaration
string choice;


do{

choice = Console.ReadLine();


if(choice == "1")
{

Console.WriteLine("Yay start");
Console.WriteLine("say something");
string answer = Console.ReadLine();
Console.WriteLine(answer);


}

if(choice == "2")
{
Console.WriteLine("Do this");
}

if(choice == "3")
{
Console.WriteLine("Bye bye");
return;
}

else
{
Console.WriteLine("that was not an answer");
}

}while (choice != "quit");
ile show the terminal output
Angius
Angius9mo ago
?
HD-Fr0sT
HD-Fr0sT9mo ago
No description
Jimmacle
Jimmacle9mo ago
your problem isn't the readlines your problem is the logic in your loop wait i got thrown off by your spacing i mean, they're not interfering with each other because that's not a thing that can happen
HD-Fr0sT
HD-Fr0sT9mo ago
i mean they are active at the same time
Jimmacle
Jimmacle9mo ago
what does "active" mean?
HD-Fr0sT
HD-Fr0sT9mo ago
i mean the else else { Console.WriteLine("that was not an answer"); }
Jimmacle
Jimmacle9mo ago
okay, so look at all your if statements follow the logic in your code
HD-Fr0sT
HD-Fr0sT9mo ago
they are all in the same lane
Want results from more Discord servers?
Add your server