mardi 31 mars 2015

Can if statements be broken half way through?

I was just wondering if an 'if' statement that is halfway through running will stop running if the conditions it has to meet are no longer met. It is hard to explain with words, here is an example:





boolean flag = true;

if(flag){

//Some code execution here (code execution #1)

flag = false;

//Some more code execution here (code execution #2)


}



Will the "code execution #2" run in this case? Or will the the rest of the if statement be skipped when flag is set to false?


Aucun commentaire:

Enregistrer un commentaire