In Visual Studio I used the following code:
private bool answer = true;
Private Buttonclick()
{
if()
{
answer =false
}
The reason the warning pops up is not because the variable is never assigned, but because it is in fact never used for any sort of comparison in the rest of the code.
Please go through this reference: http://weblog.west-wind.com/posts/2009/Feb/28/Variable-is-assigned-but-its-Value-is-never-used-Warning