CONSOLE READLINE HELP

Ping_Wing

Civil Gamers Expert
Feb 24, 2021
11
0
91
Hello there. I was trying to get mnscript to detect if I type Yes/No. However, after hours of trying with "if" commands to no avail, I seek out the help of the community. Thanks
 

Ping_Wing

Civil Gamers Expert
Feb 24, 2021
11
0
91
I have this so far but it does not work.

using System;
using Console;



while(true){
string text = Console.ReadLine();
Console.WriteLine("Say Yes or No");
if(text = "Yes" ()){
Console.WriteLine("You said Yes"());
}else{
Console.WriteLine("You said No");
}
 

lybbx

CG Super VIP
Donator
Dec 25, 2020
76
40
91
aha x
while(true){
string text = Console.ReadLine();
Console.WriteLine("Say Yes or No");
if(text == "Yes" ()){
Console.WriteLine("You said Yes"());
}else{
Console.WriteLine("You said No");
}

use == instead when comparing shit
 

Ping_Wing

Civil Gamers Expert
Feb 24, 2021
11
0
91
Many thanks to @TAC Heavysteam who gave me a little quick fix!

I'll leave it here if anyone needs it...

using System;
using Console;


// Console.ReadLine pauses the program until a command is typed.
// When something is typed in console, it will be assigned to the variable.
// This will also prevent the input from being processed as a command on the terminal.

while(true){
Console.WriteLine("Say Yes or No");
string text = Console.ReadLine();
if(text == "Yes"){
Console.WriteLine("You said Yes");
}else{
Console.WriteLine("You said No");
}
}