这段代码中说if (bar = true)
找不到我在if (foo == "True")
or中创建的变量“bar”的部分if (foo == "False")
。
代码:
string foo = Console.ReadLine();
if (foo == "True") {
bool bar = true;
}
if (foo == "False") {
bool bar = false;
}
if (bar = true) {
Console.WriteLine("This is true");
}
else {
Console.WriteLine("This is false");
}