In Visual Studio I used the following code:
private bool answer = true;
Private Buttonclick()
{
if()
{
answer =false
}
In addition to the answers above, for more deep understanding of the this warning:
This warning will not always pop-up (if you not use assigned variable). Assigning a non-constant expression or method result will NOT generate the warning. It is done intentionally, since such an unassigned variables can be used in debugging.
For example:
var answer = SomeObject.SomePropery; //will not generate CS0219
There are excellent explanation in Microsoft.Docs: https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0219