I want to be able to break out of an if statement (A) if c() is true.
I sketched some code here, which would do what I want, however with a very ugly loop. Is there any way I can do the equivalant, as fast as possible without a loop? Requirements:
- c() should only be called if a() and b() are true. They should all be called once.
- Without writing or reading an external variable.
//statement A
if (a()) {
//always repeats once, dirty solution.
for (int i = 0; i < 1; i++) {
if (b()) {
if (c()) {
break;
} else {
//code
}
}
//code (if b() and c() are true, then this should be unreachable.)
}
}
I am going to repeat this code about 1000 times a second, for hours. So it that is the reason behind the performance.