for ... else ... full statement

for i in [1,2,3]:

    Print (i)
the else :
    Print ( " will execute it? " )
Print ( " execution ended " )

Output:

1

2

3

You will perform it?

# For the implementation of the end of the traverse over all, else it will perform

 

for i in [, 2, 3]:
    Print (i)
    IF i == 2:
        BREAK
the else
:
    Print ( " ? will execute it " )
Print ( " execution ended " )

Output:

1

2

# For the implementation of the end of the traverse is not finished, and therefore will not be executed else

Guess you like

Origin www.cnblogs.com/xushan03/p/11365704.html