Nested If … else statements, use braces
int x = 5, y = 10;
if ( x > y)
{
if ( x > 0 )
{
cout << “x positive and > y”;
}
else if ( x < 0)
{
cout << “x negative and > y”;
}
else if ( x == 0)
{
cout << “x negative and > y”;
}
else
{
cout << “x less than y”;
}
As soon as the program finds one of the boolean expressions to be true is executes the associated block of code and skips past the whole rest of the if … else block.