While Guard To Condition¶
Sourcery refactoring id:
Move a guard clause in a while statement's body into its test.
location = "Work" destination = "Home" while True: if location == destination: break location = travel()
location = "Work" destination = "Home" while location != destination: location = travel()
Removing the guard clause simplifies the code and makes clearer the intention of the loop.