+ 1
To control the flow of a program correctly. for example,
if (x > 10) {
// do some things
int foo = 1;
if (x < 100) {
// do some more stuff
foo += 1;
}
}
Without a nested if you would have to recheck the previous conditions and change the position of foo, which would actually change its scope which might be undesirable.