I have an embarrassingly simple C# question, but consider the following code:
using System;
namespace ConsoleApp3
{
internal class Program
{
private static void Main(string[] args)
{
var valid = true;
var something = Console.ReadLine();
if (something == "Boom")
{
valid = false;
}
valid = DetermineSomethingElse();
if (!valid)
{
return;
}
Console.WriteLine("Kerplamo");
}
private static bool DetermineSomethingElse()
{
var random = new Random();
var next = random.Next(0, 5);
return next == 3;
}
}
}
ReSharper claims that the valid assignment in:
if (something == "Boom")
{
valid = false;
}
Isn't used, and that I can safely remove it, but I don't think this is accurate.
Am I missing something blatantly obvious, or is ReSharper making an error analyzing my code?
Edit: Nevermind, I'm an idiot!
Thanks