lundi 29 février 2016

Which order does the else statement follow?

I wanted to be sure about something,

When i have multiple if/else conditions and if does not imply an else condition for one of those if conditions; does the next else statement goes for the last if statement?

For example:

if(condition1)
{
//operation1
}

if(condition2)
{
//operation2
}

else
{
//operation3.  
}

Like above example, if i don't use an else for the first if statement, which if statement does this else work for? Would this cause a problem for me, if i don't specify the else for each if?

I made some tests but wanted to be sure about how does this works actually.

Aucun commentaire:

Enregistrer un commentaire