educative.io

This isn't a nested statement

Isn’t a nested if statement is where an if statement is within the scope of another if statement? This is just an if-else statement. Also, why must there be two tags? The tagging box is quite frustrating and probably preventing people from actually asking questions.

Hey @Brett_Myers!
Could you please share the lesson link?

Sorry for the delay.

Hey @Brett_Myers!
When we use an else-if statement, it is an if statement used within the else part of another if. In this way, it is nested.

Hey Aiman,
That is just an “if-else” statement. It is not “nested”. Nested means that it is executed within the scope of another statement. Your section on nested loops is an example of this. If you want a “nested if-else” statement, it would be:

if(x==0){
if(y==0){
y++;
}else{
y–;
}
}

Thanks,
Brett

Hey Aiman,
Sorry to beat this into the ground, but I searched for a better explanation on the terminology. I think the term your looking for is an “else if” statement.
Thanks,
Brett

https://eecs.oregonstate.edu/ecampus-video/CS161/template/chapter_4/ifelse.html