Loop ... Else Clause, Partial Functions & Type Hints
Loop ... Else Clause
For... else
items = [1 , 2]
for i in items:
print("number", i)
# if we break the loop at some point the else would not work
if(i == 2):
break
else:
print("The loop is either empty or did not run normally")While... else
Last updated