I have code like this:
public void Method()
{
if(something)
{
// Some code
if(something2)
{
// Now I should break from ifs and go to the code outside ifs
}
return;
}
// The code I want to go if the second if is true
}
Is there a possibility to go to that code after ifs without using any go to statement or extracting rest of the code to the other method?
Yes, I know Else ;)
But this code is farly long and should be run IF the first IF is false and when the first IF is true and the second is false.
So extracting a method I think is the best idea.
else
might be enough. Bu tin general you should structure your code so that you don't need this.else
or!something2
etc. So your code really won't help get a good answer. I suggest to give a better example or post your actual code.else return;
isn't a viable option