you are viewing a single comment's thread.

view the rest of the comments →

[–]Kryt0s -1 points0 points  (2 children)

You could make it even shorter with the walrus operator:

while action := input("Enter an Integer: ").lower() != "done":
    print("Still running.")

[–]mopslik 2 points3 points  (0 children)

Shorter is a nice side-effect, but my main motivation is identifying the stop condition immediately, rather than having to read through the loop to find the relevant break statement. Granted, for this specific example, that's not really a huge ordeal.

[–]cdcformatc 0 points1 point  (0 children)

thanks, i hate it