I am trying to create a try and catch statement, but I have problems with scopes, the changes that I make in catch statement don't appear once I get back to try. Is there any way around this? I am giving the example:

```
int num_fails = 0;
int num_tries = 0;
while(true) {
    try {
        num_tries++;
        some_function();
        if (num_tries > num_fails)
            break; 
    }
    catch(Exception e) {
        num_fails++;
    }
}

```

When exception happens, num\_fails in if statement stays 0.