lundi 10 août 2015

Python - How does the flow of execution go in nested if/else statements?

If I have two if statements and then an else, how do I know which if statement the else applies to? Is it by the indentation? For example this,

if x == 2:
    if y == 3:
        x = y
else:
    y = x

Which if statement does the else refer to?

Aucun commentaire:

Enregistrer un commentaire