I have something like this:
static int cantryagain=0;
private void myfunction(){
if (cantryagain==0)
{
if(variableA=1)
{
//do my stuff
//ta daaaa
}
else
{
//do something magical that will help make variableA=1 but
//if the magic doesnt work i only want it to try once.
tryagain();
}
}
}
private void tryagain
{
myfunction();
cantryagain=1; //to make sure the magic only happens once, but
//obviously it never gets here as it does
//myfunction again before it ever can...
}
I know this code is super lame. I'm fairly new to c#.
How could I correctly make something like this?