For - Else
The else keyword in a for loop specifies a block of code to be executed when the loop is finished:
The else block will NOT be executed if the loop is stopped by a break statement.
for x in range(6):
print(x)
else:
print("Finally finished!")
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrev